About iStochastic

 

I have a MQL4 code:

for(int i = 0;i < 3;i++)

{

   kline[i] = iStochastic(NULL, Period(), 8, 3, 3, MODE_SMA, 0, MODE_MAIN, i);

   dline[i] = iStochastic(NULL, Period(), 8, 3, 3, MODE_SMA, 0, MODE_SIGNAL, i); 

}

But MQL5 dones't have MODE_MAIN and MODE_SIGNAL.

How should I get this result at MQL5?

The document I can't understand..:(

Please help me.

Thanks.

 
Hsuani Chen: The document I can't understand..:(
  1. Why can't you?

    Technical Indicators / iStochastic - Reference on algorithmic/automated trading language for MetaTrader 5 says

    The buffer numbers: 0 - MAIN_LINE, 1 - SIGNAL_LINE

    those are defined in Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines - Reference on algorithmic/automated trading language for MetaTrader 5
    Following the example you get:
    int handle;
    int OnInit(){
       handle=iStochastic(_Symbol,_Period,8,3,3,MODE_SMA,STO_LOWHIGH);
       :
    void OnCalculate(...){
       :
       int amount = rates_total-prev_calculated+1;
       if(CopyBuffer(ind_handle,MAIN_LINE,0,amount,kline)<0) ...
       if(CopyBuffer(ind_handle,SIGNAL_LINE,0,amount,dline)<0) ...
    
 
You can visit this page for reference