iRSIOnArray Bug

 

There seems to be a minor bug in iRSIOnArray for that I couldn't find a reason why it would not work.

See this code:

  double buffer[3] = { 100, 101, 102 };
  int period=2;
  int shift=0;
  Print(iRSIOnArray(buffer,0,period,shift)); // --> 0.0 (expected: 100.0)

iRSIOnArray does not return 100.0 when the price is constantly moving up (so that SumN is 0 and SumP is >0.)

But it must be 100, this is also according to the computation in RSI.mq5.

Did I miss anything?


Even if I use two buffers, one with ascending, one with descending numbers, I only get zeroes:

  double buffer1[] = { 100, 101, 102, 103, 104 };
  double buffer2[] = { 104, 103, 102, 101, 100 };
  int period=3;
  int shift=0;
  Print(iRSIOnArray(buffer1,0,period,shift)); // --> 0.0 (expected: 100.0)
  Print(iRSIOnArray(buffer2,0,period,shift)); // --> 0.0 (or maybe here, but that would be rather strange as the docu says 'left to right')
 
All functions iXXXOnArray() in mql4 are bugged somehow.
Reason: