I want to move an old indicator to MQL 5 and therefor need iRSIOnArray equivalent. Searched, but couldn't find anything so far.
Would someone be so kind to point me to an implementation?
Ok, I took this as sort of hint and it seems there's some git hub code that could be used.
For anyone interested here's the link: https://github.com/Shmuma/mt-tools/blob/master/mt5/IndicatorsOnArray.mqh
I hope you don't have to use this implementation with a long period and a buffer as it will be very inefficient.
EDIT: And in my opinion this is a bug or at least leads to an not standard RSI :
if (neg > 1e-5)
rsi = 100.0 - 100.0 / (1 + pos / neg);
You can look at XXXXOnBuffer() functions in MovingAverages.mqh (provided with MT5) and code RSI in a similar way.
Hopefully one day I will be allowed to share my codes :-)
Will do so and post something here when I got my head around this.
And this looks like a bug, too, it should be nsum:
pos = psum / period;
neg = psum / period;
2019.01.02 14:31 |
Karputov | Indicators | MetaTrader 5
Thanks Vladimir, I've put everything together into a neat iRSIOnArray look-alike for MT5. Should work like the original:
double iRSIOnArray_(double &array,int total,int period,int shift)
if(period<=1 || shift<0 || stop<=period)
for(i=1; i<=period; i++)
for(; i<stop; i++)
rsi=(AvgP==0.0 ? 50.0 : 100.0);