Strange in copybuffer ATR
Try printing ATR[rates_total-1].
But also you don't need to put CopyBuffer inside a loop it is not good practice. It needs to run only once to get all the values in the buffer. But you will need to search for limit and to_copy to define the lookbacks right.
And I would strongly recommend that you separate for the for loop from the Copybuffer in your project and test both of them on its own. Because like this you are mixing them up until you don't know which is which.
Instead finding out which is which and how they work should be the first thing to do.
Minh Truong Pham: I found something strange in copybuffer atr indicator. the value return EMPTY_VALUE if shift is far from current. Anyone get this problem?
Nothing strange there. To calculate a SMA of length 200, you need at least 200 values. The "a" in ATR means average.
for(int i=401;i<rates_total - 199 ;i++)

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I found something strange in copybuffer atr indicator. the value return EMPTY_VALUE if shift is far from current. Anyone get this problem?