Can't close position
Jean Francois Le Bas:
here is a better way to do it
check
if (iTime(NULL,0,0) - OrderOpenTime() > 60 * 5)
CloseOrder()
you need to loop through all the opened orders
Jean Francois Le Bas:
here is a better way to do it
check
if (iTime(NULL,0,0) - OrderOpenTime() > 60 * 5)
CloseOrder()
you need to loop through all the opened orders
edopica:
These errors could be caused by other lines - show more of your latest code.

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
I just started studying mql5 and i want to write a program that open a position at the opening of a bar and close it at the close(in 5M timeframe, so after 5 minutes).
for the opening there are no problems, but running the backtest i notice that it stops after opening the first order; can anyone tell me if there is something wrong in the close function?