Hi guys, I don´t know what else to do now, so I ask for a bit of help. I´ve been struggling for several days now. I´m rewriting a MQL4 indicator that I created into MQL5. I just want the MA slope, and I normalize it with the ATR, so then I can aggregate this indicator values with the same indicator in other pairs.
The logic for each calculation point is basically is (MA[i] - MA[i-1]) / ATR[i], so bear in mind that I need one value more in the MA buffer than in the ATR buffer.
Finally I don´t have any more "out of range errors", but I don´t know what I´m doing wrong to get this odd calculations. Let me copy an screenshot, and you will see that when the MA is going down the Indicator is still positive but it should be below zero.
I´ll copy the whole indicator below. I suspect that it is something in the way an indicator values is read (from X to 0) and how the CopyBuffer array is read (from 0 to X) but I do travel the buffer from 0
Any help is massively appreciated.
I´ve found the issue. Nothing like posting in a forum to have the aha moment. values[bar] is wrong.
- 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 guys, I don´t know what else to do now, so I ask for a bit of help. I´ve been struggling for several days now. I´m rewriting a MQL4 indicator that I created into MQL5. I just want the MA slope, and I normalize it with the ATR, so then I can aggregate this indicator values with the same indicator in other pairs.
The logic for each calculation point is basically is (MA[i] - MA[i-1]) / ATR[i], so bear in mind that I need one value more in the MA buffer than in the ATR buffer.
Finally I don´t have any more "out of range errors", but I don´t know what I´m doing wrong to get this odd calculations. Let me copy an screenshot, and you will see that when the MA is going down the Indicator is still positive but it should be below zero.
I´ll copy the whole indicator below. I suspect that it is something in the way an indicator values is read (from X to 0) and how the CopyBuffer array is read (from 0 to X) but I do travel the buffer from 0
Any help is massively appreciated.