PDA

View Full Version : Delete Order After a Number of Bars have Past.



obbia9a9
10-21-2008 13:16, 01:16 PM
Can someone please assist me with code to delete an open Buy/Sell Stop order that has been opened for any number of bars back.

Thanks in advance,

obtaobcctt
09-28-2021 06:33, 06:33 AM
Int BarCount; init() /Place an order if(SignalOpen) OrderSend() BarCount = Bars; /Combine the order if(BarCount 5 lt;= Bars) OrderDelete();

obbia9a9
09-28-2021 07:54, 07:54 AM
@ RR; I love the quick reply. I can help you.

int BarCount; init() /Place an order if(SignalOpen) OrderSend() BarCount = Bars; /Combine the order if(BarCount 5 lt;= Bars) OrderDelete();

int BarCount; init() /Place an order if(SignalOpen) OrderSend() BarCount = Bars; /Combine the order if(BarCount 5 lt;= Bars) OrderDelete();

obbia9a9
09-28-2021 09:15, 09:15 AM
I tried using your code and I think I am doing something wrong since the trade the next bar open with the next code is being closed by the EA. Please advise, Inserted Code for(cnt=0;cntlt;complete;cnt ) OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()lt;=OP_SELLSTOP /test for opened position OrderSymbol()==Symbol()) /test for symbol if(OrderType()==OP_BUYSTOP) /buystop position is started if(TotalOrdersMode(MagicNumber,OP_SELL) lt;= 0) if(BarCount 5 lt;= Bars) ticket = OrderDelete(OrderTicket(),Green); else/go to sellstop position if(TotalOrdersMode(MagicNumber,OP_BUY) lt;= 0) if(BarCount 5 lt;= Bars) ticket = OrderDelete(OrderTicket(),Red);
int BarCount; init() /Place an order if(SignalOpen) OrderSend() BarCount = Bars; /Combine the order if(BarCount 5 lt;= Bars) OrderDelete();