How to cancel a buy entry order that is waiting based on some conditions?
for(i = OrdersTotal()-1; i >= 0; i--){
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() == OP_BUYLIMIT){
if(Bid < OrderStopLoss()){
OrderDelete(OrderTicket(), Red);
}
}
}
I need help with cancelling buy or sell limit for specific currencies pairs if the opposite order limit touched.
example:
I have 10 pending trades
buy limit and sell limit for eurusd
buy limit and sell limit for gbpjpy and so on.....
if the sell limit for eurusd touched then cancel buy limit for eurusd only
Say I have an order open for EURUSD:
BUYSTOP Limit 1.4020
Takeprofit 1.4060
Stoploss 1.3960
But if the market doesn't go to the BUYSTOP Limit to get the order filled, instead it keeps going lower below the Stoploss level, then I would like to cancel this Entry order completely.
How can this be programmed?. Any ideas would be of great help. Thanks.
Sp