-
IndicatorBuffers(2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,clrAqua); SetIndexBuffer(1,ExtATRBuffer);
You only have one array, why are you making it buffer two?
-
for(int i = rates_total - (prev_calculated < 1 ? 1 : prev_calculated); i >= 0; i--){ if(i<rates_total-c) //if there are enough bars aviable to calculation then calculate
See How to do your lookbacks correctly #9 — #14 & #19.
-
ExtATRBuffer[i] = iATR(Symbol(),0,c,0);
You are assigning the same value to all bars. - ironhak: I was trying to plot ADR on a separate window, can someone point me what I'm doing wrong?
You are calling ATR for the current chart. You are not getting ADR which requires the daily chart.
-
Since the source data is a higher TF, you must reprocess all source bar zero values to get the stair step effect, (one source bar, multiple chart bars.)
How to do your lookbacks correctly #9 - #14 & #19 -
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019) -
else //else = 0 ExtATRBuffer[i] = 0;
You must use EMPTY_VALUE, since you didn't change it in init.
-
You only have one array, why are you making it buffer two?
-
See How to do your lookbacks correctly #9 — #14 & #19.
- You are assigning the same value to all bars.
-
You are calling ADR ATR for the current chart. You are not getting ADR which requires the daily chart.
-
Since the source data is a higher TF, you must reprocess all source bar zero values to get the stair step effect, (one source bar, multiple chart bars.)
How to do your lookbacks correctly #9 - #14 & #19 -
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019) - You must use EMPTY_VALUE, since you didn't change it in init.
My bad, I mean ATR not ADR. Anyway thank's, I'll study better the loop process.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I was trying to plot ATR on a separate window, can someone point me what I'm doing wrong?
Thank's for helping.