MT5 convert from MT4 Indicator not plotting properly

 

Hi,


I am close to converting an indicator from MT4 to MT5; however, the converted indicator is not plotting properly.  In addition, there is a "divide by zero" error on line 73/column 18.  Somewhere, there is a mistranslation.  What am I missing in the MT5 conversion, relative to the MT4 code?  What am I doing wrong?  Thank you all.

 
Matthew Renner: What am I missing in the MT5 conversion, relative to the MT4 code?  What am I doing wrong?
  1.     H=high[ArrayMaximum(high, Frame, pos)];
        L=low[ArrayMinimum(low, Frame, pos)];
        :
        Buffer[pos]=SmoothCoeff*Mit+(1-SmoothCoeff)*Buffer[pos+1];
    You are treating high/low/buffer as series but never setting them.
    To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference

  2.    if(rates_total<=Frame) return(rates_total);
       int ExtCountedBars=prev_calculated;
       if (ExtCountedBars<0) return(rates_total);
       int limit=rates_total-2;
       if(ExtCountedBars>2) limit=rates_total-ExtCountedBars-1;
       pos=limit;
       while(pos>=0)
    Unreadable, probably not correct.
              How to do your lookbacks correctly.
 
whroeder1:
  1. You are treating high/low/buffer as series but never setting them.

  2. Unreadable, probably not correct.
              How to do your lookbacks correctly.

Thanks for the response.  Turns out the ArrayMaximum parameters are reversed in MT5 vs. MT4.  That was the issue.

Reason: