metatrader4 - mql5 how do i automatically delete un-triggered pending orders before placing new orders -
metatrader4 - mql5 how do i automatically delete un-triggered pending orders before placing new orders -
i working on project requires me place purchase stop , sell stop orders , on next bar if orders not triggered, delete them , place fresh ones. here code
if(logic == true && orderstotal() == 0) {bool res = ordersend(....);} if(orderstotal() != 0) { if(ordertype == op_buy || ordertype == op_sell) { bool del = orderdelete(....); } }
this code placing orders , deleting them when testing. when ea active on live server, not open orders because platform has orders of other instruments open. i'm sure there quite easy way around since novice, i'm not able figure out. ideas?? help.
it not clear whether utilize magic number , symbol check. should check sth like
int _orderstotal = orderstotal(); (int = _orderstotal; >= 0; i--){ if (ordersymbol() != symbol() && ordermagicnumber() != magic) continue; .... }
in different realization, i.e. can create function(string symbol) checks if have working orders placed of indicated symbol.
metatrader4 mql5
Comments
Post a Comment