Below is a snippet of code responsible for closing trades, but the thing is that when pending orders are not executed it does not delete them, I can't figure out why. But when I need to close a pending order that has already been executed, everything goes correctly and if the order hasn't been executed then it just hangs there until it executes...
Below is a snippet of code responsible for closing trades, but the thing is that when pending orders are not executed it doesn't delete them, I can't understand why.
Use the NormalizeDouble(lot,2) function
Thank you. I suspect that's what I was looking for.
Thanks for the discussion. Your information will come in handy as well.
Where is the fault ')' hiding here? - wrong parameters count 4 times? Maybe this is not how it should be written?
Where is the fault ')' hiding here? - wrong parameters count 4 times? Maybe this is not the way to write it?
Gentlemen professionals, I need your help again!
Below is a snippet of code responsible for closing trades, but the thing is that when pending orders are not executed it does not delete them, I can't figure out why. But when I need to close a pending order that has already been executed, everything goes correctly and if the order hasn't been executed then it just hangs there until it executes...
OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
Magic = OrderMagicNumber();
orderticket = OrderTicket();
if (OrdersTotal() == 1 && Magic == 111 && OrderType( ) == 0)
{
if (H1_BUY_5 == 0 || H1_BUY_1 == 0)
{
OrderClose(orderticket, lots, Bid, 5, Yellow);
if (OrdersTotal() == 1) OrderDelete(orderticket, Brown);
}
}
Xaoss1990:
Below is a snippet of code responsible for closing trades, but the thing is that when pending orders are not executed it doesn't delete them, I can't understand why.
if (OrdersTotal() == 1 && Magic == 111 && OrderType( ) == 0)
this interferes
I put a function in my EA to close 1/3 of open lot when stoploss is triggered at breakeven, but for some reason it doesn't work.
Can you tell me what's wrong?
I put a function in my EA to close 1/3 of open lot when stoploss is triggered at breakeven, but for some reason it doesn't work.
Can you tell me what's wrong?
Probably because you calculate the lot first and then