Vortex by ainhnnos

59 downloads / 355 views / Created: 26.04.2017
 Average Rating: 0

Indicator Description

Vortex Indicator

Comments

//============================================================== // 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]
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 - 2017, Miroslav Popov; Created by Yavor Kirov