Alternative to "shift" in iRSI for MQL4 to MQL5

 

I came across an custom indicator that was written in MQL4 and am trying to translate it to MQL5. However, understand that the transition of the MQL4 to MQL5 has changed the iRSI function i.e. removing of the "shift" parameter.

As such, wanted to check if my proposed translation would sufficient meet the intention of the MQL4 code

MQL4 

int start(){
    int countedBars = IndicatorCounted();
    if(countedBars < 0){
       countedBars = 0;   
       CalculateIndicator(countedBars);
    }
    return(0);   
}     
     
void CalculateIndicator(int countedBars){    
     for (int i = Bars - countedBars; i >= 0; i--){
        Calculatersi(i);
     }              
}

void Calculatersi(int i){
      rsi[i] = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE,i);   
}

MQL5

int start(){
    int countedBars = IndicatorCounted();
    if(countedBars < 0){
       countedBars = 0;   
       Calculatersi(countedBars);
    }
    return(0);   
}     
     
void Calculatersi(int countedBars){
     CopyBuffer(handleRSI,0,0,countedBars,rsi);
}

Thank you. 

 
  1. The shift and buffer index were not removed; they were moved to the CopyBuffer call.

  2. You should stop using the old event handlers and IndicatorCounted() and start using new event handlers.
              Event Handling Functions - MQL4 Reference
              How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 (2016)

 
William Roeder #:
  1. The shift and buffer index were not removed; they were moved to the CopyBuffer call.

  2. You should stop using the old event handlers and IndicatorCounted() and start using new event handlers.
              Event Handling Functions - MQL4 Reference
              How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 (2016)

Thanks William for the quick reply! Will take a look at the two links and see how I can weave this into the codes!
Reason: