High i have a mql4 EA that uses the iMA() function to trade using moving averages. In mql5 ive noticed the function misses a key parameter the bar shift which is the last parameter in the mql4 version and i cant figure a way to do this alternatively. Can someone please tell me how to read moving average values for previous bars in mql5? This is very urgent!
- MQL5 Wizard: Development of trading robots for MetaTrader 5
- When MetaTrader 5 Web Terminal is indispensable
- How to copy deals of successful traders in MetaTrader 5
tonny:
High i have a mql4 EA that uses the iMA() function to trade using moving averages. In mql5 ive noticed the function misses a key parameter the bar shift which is the last parameter in the mql4 version and i cant figure a way to do this alternatively. Can someone please tell me how to read moving average values for previous bars in mql5? This is very urgent!
In MQL5 you only get an indicator handle using iMA() function. Then you have to copy the actual indicator values from the handle to a buffer using CopyBuffer() function. As a result you'll have an array of indicator values for all the bars you specify in CopyBuffer() function.
High i have a mql4 EA that uses the iMA() function to trade using moving averages. In mql5 ive noticed the function misses a key parameter the bar shift which is the last parameter in the mql4 version and i cant figure a way to do this alternatively. Can someone please tell me how to read moving average values for previous bars in mql5? This is very urgent!
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
- www.mql5.com
Timeseries and Indicators Access / CopyBuffer - Documentation on MQL5
Migrating from MQL4 to MQL5 - 17.technical indicators
double iMAMQL4(string symbol, int tf, int period, int ma_shift, int method, int price, int shift) { ENUM_TIMEFRAMES timeframe=TFMigrate(tf); ENUM_MA_METHOD ma_method=MethodMigrate(method); ENUM_APPLIED_PRICE applied_price=PriceMigrate(price); int handle=iMA(symbol,timeframe,period,ma_shift, ma_method,applied_price); if(handle<0) { Print("The iMA object is not created: Error",GetLastError()); return(-1); } else return(CopyBufferMQL4(handle,0,shift)); }
Lol "high" instead of hi. Thanks guys im gona build it and see, you both gave me a lead.

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