Indicators: Donchian Channels - page 2

 

Hi,

iHighest and iLowest functions are so slow into the indicator code. I used ArrayMaximum and ArrayMinimum functions in the OnCalculate event and it is faster than original code.

So you can use like this

         case HIGH_LOW:

            //SsMax=high[iHighest(high,DonchianPeriod,bar)];

            //SsMin=low[iLowest(low,DonchianPeriod,bar)];

            SsMax=high[ArrayMaximum(high,bar-(DonchianPeriod-1),DonchianPeriod)];

            SsMin=low [ArrayMinimum(low,bar-(DonchianPeriod-1),DonchianPeriod)];            

            break;



 

Who do the min and max values of the channel in the data window not correspond exactly to the min or max values of the bar that the high or low was calculated from?

You can even see it in the screenshot provided by the OP; the high mark is not a straight line, but it wiggles a few ticks up and down, even though the real high value has not changed. Why is that?

Anyone know why that happens?

Does the "high" array not correspond to the high that is plotted by the bars on the chart?