I am trying to use a divergence condition in my strategy, but I'm not really sure how to go about it.
What I am trying to achieve is something like "when the price makes a new low, but the indicator makes a higher low... do this"
I've created two series for the indicator's swing High and Low, but I'm not sure how to move on from here
Also, is the Closes[2] the right approach, or should I use BarsInProgress[2] and what exactly is the difference between the two variants?
Thankyou
private Series<double> dmiHigh; private Series<double> dmiLow; .... else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Tick, 1); AddDataSeries(Data.BarsPeriodType.Minute, 5); } else if (State == State.DataLoaded) { DMI1 = DMI(Closes[2], Convert.ToInt32(DmiPeriod)); AddChartIndicator(DMI1); dmiHigh = new Series<double>(DMI(Closes[2], Convert.ToInt32(DmiPeriod)), MaximumBarsLookBack.TwoHundredFiftySix); dmiLow = new Series<double>(DMI(Closes[2], Convert.ToInt32(DmiPeriod)), MaximumBarsLookBack.TwoHundredFiftySix); } protected override void OnBarUpdate() if (DMI1[1] < DMI1[2] && DMI1[2] > DMI1[3]) dmiHigh[2] = DMI1[2]; if (DMI1[1] > DMI1[2] && DMI1[2] < DMI1[3]) dmiLow[2] = DMI1[2]; // What now?!? {
Comment