Matthew Renner: What am I missing in the MT5 conversion, relative to the MT4 code? What am I doing wrong?
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 Referenceif(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:
- You are treating high/low/buffer as series but never setting them.
- 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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.