Roger:
You have to check is old OrderStopLoss() equal TL_Long or not.
this isnt the problem bcs the order modify are working right on time.
but in the 5 minutes from 6:55 to 7:00 its run all 10 seconds
is Done static or external?
done is static integer
i set it to 0 2 hours before time
if (Hour() == (Start1 - 2) && Minute() >= 0){ done = 0; // set done to 0 2 hours before }
You set it zero, modify order, set to one.
next tick repeat
Minute()>=0 is always true
Also this won't work in the tester. Hour/Minute() is current server time where as you want the time of the tick TimeHour(CurTime())

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
Hello
when i like to modify the order the code runs multible in the ea
if (Hour() == (Start1 - 2) && Minute() >= 0){
done = 0; // set done to 0 2 hours before
}
if (done == 0){ // if done is 0 modify order
for (int i=0;i<OrdersTotal();i++){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment() == Text && Hour() == (Start1 - 1) && Minute() >= 55 ){
if( OrderType() == OP_BUY && OrderProfit() != 0 ){ //no buy order
Ticket = OrderModify(OrderTicket(),OrderOpenPrice(),TL_Long,OrderTakeProfit(),OrderExpiration(),Blue);
}
if( OrderType() == OP_SELL && OrderProfit() != 0 ){ //no sell order
Ticket = OrderModify(OrderTicket(),OrderOpenPrice(),TL_Sell,OrderTakeProfit(),OrderExpiration(),Green);
}
done = 1; // set done to 1
}
}
Sleep(10000);
}
anybody has any idea?
kind regards