indicator "shift"

 

Hi,

in mql4:

exmple:

double iRSI( string symbol, int timeframe, int period, int applied_price, int shift)


in mql5:

int iRSI(string symbol,  period, int ma_period, applied_price)


Where is the "shift" parameter? How can i make it?

Thanks.

 
SeWER posted  :

Hi,

in mql4:

exmple:

double iRSI( string symbol, int timeframe, int period, int applied_price, int shift)

in mql5:

int iRSI(string symbol,  period, int ma_period, applied_price)

Where is the "shift" parameter? How can i make it?

Thanks.

  

All indicators in MQL5 return a handle to a buffer.

The simplest way to return just one value from an indicator is use the IndicatorValue function below. 

void OnTick()  
  {
    // ...
    double RSIshift=IndicatorValue(iRSI(symbol,period,ma_period,applied_price),shift);
    // ...
  }
  

double IndicatorValue(int handle,int shift,int buffer_num=0)
  {
   double buffer[];
   if(CopyBuffer(handle,buffer_num,shift,1,buffer)!=1)
     {
      Print(StringFormat("Error in IndicatorValue(%d,%d,%d): cannot copy value",handle,shift,buffer_num));
      return(0.0);
     }
   return(buffer[0]);
  }

 Paul

 
Thanks phampton!



Reason: