Vortex Indicator by zuijaideai

4599 downloads / 2960 views / Created: 23.05.2013
 Average Rating: 0

Indicator Description

Hi All,
This is a new hot indicator that is released in TASC magazine Jan 2010 called Vortex Indicator

The article by Etienne Botes and Douglas Siepman in this issue, “The Vortex Indicator”, demonstrates another reliable technical indicator for trading a change in market direction. The vortex indicator was developed as a new directional movement indicator, drawing inspiration from J. Welles Wilder’s directional movement indicator, as well as another unrelated and improved directional indicator.


Link to the forum topic: Vortex Indicator

Denny Imanuel


It doesn´t work in FSB 3.6.8:

ERROR: "Vortex Indicator" compilation failed.
Line 79 Column 36: The name 'SlotTypes_OpenFilter' does not exist in the current context

I´ve also checked, there is no DLL for Vortex at ..\User Files\Libraries, only for all the other indicators and they all show a creation time as of todays date. Which shows that Vortex is the only one that could not be compiled because of the above error....
Also not working for me, with the same message...
//============================================================== // Forex Strategy Builder // Copyright © Miroslav Popov. All rights reserved. //============================================================== // THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, // EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE. //============================================================== using System; using System.Drawing; using ForexStrategyBuilder.Infrastructure.Entities; using ForexStrategyBuilder.Infrastructure.Enums; using ForexStrategyBuilder.Infrastructure.Interfaces; namespace ForexStrategyBuilder.Indicators.Store { public class VortexIndicators : Indicator { public VortexIndicators() { IndicatorName = "Vortex Indicators"; PossibleSlots = SlotTypes.OpenFilter | SlotTypes.CloseFilter; SeparatedChart = true; // SeparatedChartMinValue = 0; IndicatorAuthor = "Denny Imanuel"; IndicatorVersion = "2.0"; IndicatorDescription = "This is a new hot indicator that is released in TASC magazine Jan 2010 called Vortex Indicator"; } public override void Initialize(SlotTypes slotType) { SlotType = slotType; // The ComboBox parameters IndParam.ListParam[0].Caption = "Logic"; IndParam.ListParam[0].ItemList = new string[] { "The VI+ rises", "The VI+ falls", "The VI- rises", "The VI- falls", "The VI+ is higher than VI-", "The VI+ is lower than VI-", "The VI+ crosses the VI- line upward", "The VI+ crosses the VI- line downward", "The VI+ changes its direction upward", "The VI+ changes its direction downward", "The VI- changes its direction upward", "The VI- changes its direction downward" }; IndParam.ListParam[0].Index = 0; IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index]; IndParam.ListParam[0].Enabled = true; IndParam.ListParam[0].ToolTip = "Logic of application of the indicator."; // The NumericUpDown parameters IndParam.NumParam[0].Caption = "Period"; IndParam.NumParam[0].Value = 14; IndParam.NumParam[0].Min = 5; IndParam.NumParam[0].Max = 200; IndParam.NumParam[0].Enabled = true; IndParam.NumParam[0].ToolTip = "The period of VI."; // The CheckBox parameters IndParam.CheckParam[0].Caption = "Use previous bar value."; IndParam.CheckParam[0].Enabled = false; IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar."; } public override void Calculate(IDataSet dataSet) { DataSet = dataSet; // Reading the parameters int iNVI = (int)IndParam.NumParam[0].Value; int iPrvs = (SlotType==SlotTypes_OpenFilter) ? 1 : 0; // Calculation int iFirstBar = iNVI + 2; double[] adVIPos = new double[Bars]; double[] adVINeg = new double[Bars]; double[] adVIOsc = new double[Bars]; double[] adVMPlus = new double[Bars]; double[] adVMMinus = new double[Bars]; double[] adVMPlusSum = new double[Bars]; double[] adVMMinusSum = new double[Bars]; double[] adTrueRange = new double[Bars]; double[] adTrueHigh = new double[Bars]; double[] adTrueLow = new double[Bars]; double[] adTRSum = new double[Bars]; for (int iBar=iFirstBar; iBarHigh[iBar]) adTrueHigh[iBar]=Close[iBar-1]; else adTrueHigh[iBar]=High[iBar]; if (Close[iBar-1]
//+--------------------------------------------------------------------+ //| Copyright: (C) 2014, Miroslav Popov - All rights reserved! | //| Website: http://forexsb.com/ | //| Support: http://forexsb.com/forum/ | //| License: Proprietary under the following circumstances: | //| | //| This code is a part of Forex Strategy Builder. It is free for | //| use as an integral part of Forex Strategy Builder. | //| One can modify it in order to improve the code or to fit it for | //| personal use. This code or any part of it cannot be used in | //| another applications without a permission. Contact information | //| cannot be changed. | //| | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | //| | //| In no event shall the author be liable for any damages whatsoever | //| (including, without limitation, incidental, direct, indirect and | //| consequential damages, damages for loss of business profits, | //| business interruption, loss of business information, or other | //| pecuniary loss) arising out of the use or inability to use this | //| product, even if advised of the possibility of such damages. | //+--------------------------------------------------------------------+ #property copyright "Copyright 2014, Miroslav Popov" #property link "http://forexsb.com" #property version "1.00" #property strict #include <Forexsb.com/Indicator.mqh> #include <Forexsb.com/Enumerations.mqh> //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class VortexIndicators : public Indicator { public: VortexIndicators(SlotTypes slotType) { SlotType=slotType; IndicatorName="Vortex Indicators"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = true; IsDiscreteValues = false; IsDeafultGroupAll = false; } virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void VortexIndicators::Calculate(DataSet &dataSet) { Data=GetPointer(dataSet); // Reading the parameters int iNVI=(int)NumParam[0].Value; int iPrvs=(SlotType==SlotTypes_OpenFilter) ? 1 : 0; // Calculation int iFirstBar=iNVI+2; double adVIPos[]; ArrayResize(adVIPos, Data.Bars); ArrayInitialize(adVIPos, 0); double adVINeg[]; ArrayResize(adVINeg, Data.Bars); ArrayInitialize(adVINeg, 0); double adVIOsc[]; ArrayResize(adVIOsc, Data.Bars); ArrayInitialize(adVIOsc, 0); double adVMPlus[]; ArrayResize(adVMPlus,Data.Bars); ArrayInitialize(adVMPlus, 0); double adVMMinus[]; ArrayResize(adVMMinus,Data.Bars); ArrayInitialize(adVMMinus, 0); double adVMPlusSum[]; ArrayResize(adVMPlusSum,Data.Bars); ArrayInitialize(adVMPlusSum, 0); double adVMMinusSum[]; ArrayResize(adVMMinusSum,Data.Bars);ArrayInitialize(adVMMinusSum, 0); double adTrueRange[]; ArrayResize(adTrueRange,Data.Bars); ArrayInitialize(adTrueRange, 0); double adTrueHigh[]; ArrayResize(adTrueHigh,Data.Bars); ArrayInitialize(adTrueHigh, 0); double adTrueLow[]; ArrayResize(adTrueLow,Data.Bars); ArrayInitialize(adTrueLow, 0); double adTRSum[]; ArrayResize(adTRSum,Data.Bars); ArrayInitialize(adTRSum, 0); for(int iBar=iFirstBar; iBar<Data.Bars; iBar++) { adVMPlus[iBar]=MathAbs(Data.High[iBar]-Data.Low[iBar-1]); adVMMinus[iBar]=MathAbs(Data.Low[iBar]-Data.High[iBar-1]); if(Data.Close[iBar-1]>Data.High[iBar]) adTrueHigh[iBar]=Data.Close[iBar-1]; else adTrueHigh[iBar]=Data.High[iBar]; if(Data.Close[iBar-1]<Data.Low[iBar]) adTrueLow[iBar]=Data.Close[iBar-1]; else adTrueLow[iBar]=Data.Low[iBar]; adTrueRange[iBar]=adTrueHigh[iBar]-adTrueLow[iBar]; adVMPlusSum[iBar] = 0; adVMMinusSum[iBar] = 0; adTRSum[iBar]= 0; for(int iBack=0; iBack<iNVI; iBack++) { adVMPlusSum[iBar] += adVMPlus[iBar-iBack]; adVMMinusSum[iBar] += adVMMinus[iBar-iBack]; adTRSum[iBar]+=adTrueRange[iBar-iBack]; } if(adTRSum[iBar]!=0) adVIPos[iBar] = adVMPlusSum[iBar]/adTRSum[iBar]; adVINeg[iBar] = adVMMinusSum[iBar]/adTRSum[iBar]; } for(int iBar=0; iBar<Data.Bars; iBar++) adVIOsc[iBar]=adVIPos[iBar]-adVINeg[iBar]; // Saving the components ArrayResize(Component[0].Value,Data.Bars); Component[0].CompName = "The VI+"; Component[0].DataType = IndComponentType_IndicatorValue; Component[0].FirstBar = iFirstBar; ArrayCopy(Component[0].Value,adVIPos); ArrayResize(Component[1].Value,Data.Bars); Component[1].CompName = "The VI-"; Component[1].DataType = IndComponentType_IndicatorValue; Component[1].FirstBar = iFirstBar; ArrayCopy(Component[1].Value,adVINeg); ArrayResize(Component[2].Value,Data.Bars); Component[2].FirstBar=iFirstBar; ArrayResize(Component[3].Value,Data.Bars); Component[3].FirstBar=iFirstBar; // Sets the Component's type if(SlotType==SlotTypes_OpenFilter) { Component[2].DataType = IndComponentType_AllowOpenLong; Component[2].CompName = "Is long entry allowed"; Component[3].DataType = IndComponentType_AllowOpenShort; Component[3].CompName = "Is short entry allowed"; } else if(SlotType==SlotTypes_CloseFilter) { Component[2].DataType = IndComponentType_ForceCloseLong; Component[2].CompName = "Close out long position"; Component[3].DataType = IndComponentType_ForceCloseShort; Component[3].CompName = "Close out short position"; } if(ListParam[0].Text=="The VI+ rises") { OscillatorLogic(iFirstBar,iPrvs,adVIPos,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_rises); } else if(ListParam[0].Text=="The VI+ falls") { OscillatorLogic(iFirstBar,iPrvs,adVIPos,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_falls); } else if(ListParam[0].Text=="The VI- rises") { OscillatorLogic(iFirstBar,iPrvs,adVINeg,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_rises); } else if(ListParam[0].Text=="The VI- falls") { OscillatorLogic(iFirstBar,iPrvs,adVINeg,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_falls); } else if(ListParam[0].Text=="The VI+ is higher than VI-") { OscillatorLogic(iFirstBar,iPrvs,adVIOsc,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_is_higher_than_the_level_line); } else if(ListParam[0].Text=="The VI+ is lower than VI-") { OscillatorLogic(iFirstBar,iPrvs,adVIOsc,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_is_lower_than_the_level_line); } else if(ListParam[0].Text=="The VI+ crosses the VI- line upward") { OscillatorLogic(iFirstBar,iPrvs,adVIOsc,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_crosses_the_level_line_upward); } else if(ListParam[0].Text=="The VI+ crosses the VI- line downward") { OscillatorLogic(iFirstBar,iPrvs,adVIOsc,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_crosses_the_level_line_downward); } else if(ListParam[0].Text=="The VI+ changes its direction upward") { OscillatorLogic(iFirstBar,iPrvs,adVIPos,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_changes_its_direction_upward); } else if(ListParam[0].Text=="The VI+ changes its direction downward") { OscillatorLogic(iFirstBar,iPrvs,adVIPos,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_changes_its_direction_downward); } else if(ListParam[0].Text=="The VI- changes its direction upward") { OscillatorLogic(iFirstBar,iPrvs,adVINeg,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_changes_its_direction_upward); } else if(ListParam[0].Text=="The VI- changes its direction downward") { OscillatorLogic(iFirstBar,iPrvs,adVINeg,0,0,Component[2],Component[3], IndicatorLogic_The_indicator_changes_its_direction_downward); } } //+------------------------------------------------------------------+
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2019, Miroslav Popov; Created by Yavor Kirov