If your compiled file does not do what it should use the debugger and control the variables and conditions on each program step:
https://www.metatrader5.com/en/metaeditor/help/development/debug
Code debugging - Developing programs - MetaEditor Help
- www.metatrader5.com
MetaEditor has a built-in debugger allowing you to check a program execution step by step (by individual functions). Place breakpoints in the code...
for (int i=OrdersHistoryTotal()-1; i >= 0; i--) { if(OrderSelect(i, SELECT_BY_POS,MODE_HISTORY)) if(OrderSymbol()==_Symbol)
-
Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum #4 and #5 (2017) -
Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020)

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
ditions are met.