First of all make it work in MQL4 - then paste it into MQL5 and resolve the issues.
I did a small migration some time back and I paste my notes below to give you an idea of some things you may need to change (I am sure there are others)
Functions
· DoubleToStr Now DoubleToString
· TimeToStr Now TimeToString
· Time measurements use MqlDateTime structuture to get hh, mm, secs.
GetMicrosecondCount() gives runtime of program
· StringConcatenate Now use manual join “str1” + “str2”
· Bid/Ask price retrieval Now use MqlTick structure and SymbolInfoTick() to read prices and other data
· AccountBalance() New MQL function is AccountInfoDouble(ACCOUNT_BALANCE)
· iMA Last parameter obsolete (shift)
Null string for Symbol() must be NULL – not “” like in MQL4
· “extern” keyword must use “input” keyword in MQL5
· OrderSend different function which uses MQLTradeRequest and MQLTradeResult structures
Array initialization
string outputReport[] = {“”}; // No longer suitable in MQL5 – creates a static array which cannot be re-sized
First of all make it work in MQL4 - then paste it into MQL5 and resolve the issues.
I did a small migration some time back and I paste my notes below to give you an idea of some things you may need to change (I am sure there are others)
Functions
· DoubleToStr Now DoubleToString
· TimeToStr Now TimeToString
· Time measurements use MqlDateTime structuture to get hh, mm, secs.
GetMicrosecondCount() gives runtime of program
· StringConcatenate Now use manual join “str1” + “str2”
· Bid/Ask price retrieval Now use MqlTick structure and SymbolInfoTick() to read prices and other data
· AccountBalance() New MQL function is AccountInfoDouble(ACCOUNT_BALANCE)
· iMA Last parameter obsolete (shift)
Null string for Symbol() must be NULL – not “” like in MQL4
· “extern” keyword must use “input” keyword in MQL5
· OrderSend different function which uses MQLTradeRequest and MQLTradeResult structures
Array initialization
string outputReport[] = {“”}; // No longer suitable in MQL5 – creates a static array which cannot be re-sized
Could you help me fix this code please
the one above
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
You have Fixed it and How?
Could you share it

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
the problems i face are:
1-suppose the atr value is 0.00589, i want it to be 589.
2-the correct atr value of the current bar never gets returned.
There is a huge problem with iATR or I simple can not use it properly so please teach me