get indicator lines for RVI

 

Hi

This code failed to copy the RVI indicator (with its 2 lines). It copies the signal line but not the rvi line. What am I doing wrong pleaes? Thanks


//ea.mql5
#include <utility.mqh>
EA1               *ea1;
int onInit(){

        ea1 = new EA1(_Symbol);
}

//utility.mqh
class EA1 {
  string  mSymbol       = symbol;
  int     rviHandle;
  double  rviBuffer[];

  public:
    EA1(string symbol){
      mSymbol       = symbol;
      rviIndicator();
    }

    void rviIndicator(){
      rviHandle = iRVI(mSymbol, PERIOD_H1, 7);
      SetIndexBuffer(1, rviBuffer, true);
      ArraySetAsSeries(rviBuffer, true);
      if(CopyBuffer(rviHandle, 1, 0, 200, rviBuffer) <= 0) {  // How can I copy the second line of the RVI indicator?
        Print("could not copy rvi for ea1 ",GetLastError() );
      } else {
        
        Print(rviBuffer[0], " ", rviBuffer[2]);
      }
    }

}
 
if(CopyBuffer(rviHandle, 0, 0, 200, rviBuffer) <= 0)

or

if(CopyBuffer(rviHandle, MAIN_LINE, 0, 200, rviBuffer) <= 0)