What went wrong here?

 

Hi everyone. Have a nice day.

I am learning MQL5 "translating" some indicators and EAs that were written in MQL4. This time, I am programming the DiNapoli Stochastic, but I find that the MQL5 indicator I programmed, has mistakes respect to MQL4 indicator. If you look so close the MQL5 indicators' outputs, that looks so diferent than original indicator outputs.

In order  to keep certain compatibility with the original MQL4 indicator, I wrote 2 functions that emulates the behavior of iHighest and iLowest functions. They are called myHighest and myLowest; that functions returns the most high or most low values of an interval, delimited by myStart and myCount parameters.

I want to know, what were the mistakes that were made to make the conversion from MQL4 to MQL5, where they are located, and which corrections must be made to ensure that indicator works properly.

I attach for your analysis, a picture of MQL5 indicator, the original MQL4 code, and the modified MQL5 code. 

Best regards,

CHATFINGER

PD: Please forgive any mistake that you find at this post. I don't speak english very well. 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties - Documentation on MQL5
 
every things going well. 

 

 


 
The two indicator buffers must be timeseries.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Drawing Styles
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Drawing Styles
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Drawing Styles - Documentation on MQL5