Printed iATR values are different compared to the ATR Chart

 

Hello, not sure why this is happening when I use the iATR function, the printed value for each ATR is different from the ATR Chart, see attached screenshot, I can't see why this would be happening, any help would be greatly appreciated


void OnTick(){
      double atr = iATR(NULL, 0, 14, 0);

      Print("****************ATR = ",atr);

}
Files:
atr-issue.png  247 kb
 
chillydk147:

Hello, not sure why this is happening when I use the iATR function, the printed value for each ATR is different from the ATR Chart, see attached screenshot, I can't see why this would be happening, any help would be greatly appreciated


Assumption: The chart shows the values of the closed candles. OnTick the values of the currently running candle.
 
Hi tomm73, thanks for your response, I don't understand your answer. I've tried to also print out the values for the iMA function but the printed values actually match the Chart values
tomm73:
Assumption: The chart shows the values of the closed candles. OnTick the values of the currently running candle.
 
chillydk147:
Hi tomm73, thanks for your response, I don't understand your answer. I've tried to also print out the values for the iMA function but the printed values actually match the Chart values

What he is saying is that you are printing the value at the candle open time (or thereabouts) but you are looking at the close value on the chart

 
Keith Watford:

What he is saying is that you are printing the value at the candle open time (or thereabouts) but you are looking at the close value on the chart

That's, I have it now