Thank you modified OrderClosePrice()...
I get no error ...the trades goes to stoploss
Then either
for (int i = OrdersTotal() - 1; i >= 0; i--)
is not being executed or
if((OrderOpenTime()<=TimeCurrent()-MaxHour*60*60) && (OrderProfit()<0))
is not returning true
Then either
is not being executed or
is not returning true
So what can I do? I not understand
You check.
A simple Print will show if a block of code is being executed
Print("for loop is being executed"); for (int i = OrdersTotal() - 1; i >= 0; i--)
If the print shows in the log then you know that the for loop is being executed.
Remove the print code once you have checked
Next check
if((OrderOpenTime()<=TimeCurrent()-MaxHour*60*60) && (OrderProfit()<0))
What value have you assigned to MaxHour?
You check.
A simple Print will show if a block of code is being executed
If the print shows in the log then you know that the for loop is being executed.
Remove the print code once you have checked
No...in the logs there's not my print comand!!
If you have written the EA as you say, you should be able to follow the code to see what it is doing and why the for loop is not being executed.
If you can't, then you are trying to work on something that is too complicated for your level.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
i'm new and I need your help.
I'm writing an EA and I want close position at market after xx hours (maxHour value) if i'm NOT at breakeven..So i wrote like this (long example)
Debug is correct, but when i try to backtest it doesn't exit position.
EA entry good on 9am time...
Why? What's wrong?
Sorry for my english