Can someone please help me with code to delete an open Buy/Sell Stop order that has been opened for a number of bars back.
Thanks in advance,
Publi |
Publi |
Can someone please help me with code to delete an open Buy/Sell Stop order that has been opened for a number of bars back.
Thanks in advance,
int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();
@ RR; I appreciate the quick reply. Hopefully I can help you one day soon.
Originariamente Scritto da ;Originariamente Scritto da ;
I tried using your code and I think I am doing something wrong because the EA is closing the open trade the next bar open with the following code. Please advise, Inserted Code for(cnt=0;cntlt;total;cnt ) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()lt;=OP_SELLSTOP /check for opened position OrderSymbol()==Symbol()) /check for symbol { if(OrderType()==OP_BUYSTOP) /buystop position is opened { 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); } } } } }
Originariamente Scritto da ;Originariamente Scritto da ;