The for loop means that it is looping from index - Periods (which is the current bar - Periods) to index - 1 (which is the previous to the last bar).
If you change this to be index - Periods - X to index - 1 - X, then you should get the desired outcome.
So,
for (int i = index - Periods - X; i <= index - 1 - X; i++)
{
upper = Math.Max(MarketSeries.High[i], upper);
lower = Math.Min(MarketSeries.Low[i], lower);
}
Rill
26 Feb 2013, 10:50
RE:
beautiful. Thank you very much.
@Rill