Download MetaTrader 5
To add comments, please log in or register
Launch your trading signal. Make profit from paid subscription!
qwqw
9
qwqw 2010.03.12 14:04 

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.

Paul
784
Paul 2010.03.13 05:26  
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

qwqw
9
qwqw 2010.03.15 18:38  
Thanks phampton!



/
To add comments, please log in or register