OrderSelect(c,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) {
if(OrderType()==Op_BuyStop) int b=OrderTicket();
if(OrderType()==Op_SellStop) int s=OrderTicket(); } }
OrderSelect(b,SELECT_BY_TICKET);
if(OrderType()==Op_Buy) {OrderDelete(s);s=0;}
OrderSelect(s,SELECT_BY_TICKET);
if(OrderType()==Op_Sell) {OrderDelete(b);b=0;} [/CODE]
integers b & s should be assigned ticket numbers when placing the buy and sell stop orders, and need code to reassign ticket number values when re-initializing the ea. When the buy or sell order is closed, one should probably use OrderCloseTime()>0 to reset b or s to zero, similar to the following:
[CODE]OrderSelect(b,SELECT_BY_TICKET);
if(OrderCloseTime()>0) {b=0;}
OrderSelect(s,SELECT_BY_TICKET);
if(OrderCloseTime()>0) {s=0;}hope this helps somewhat
How to close all orders, after one takeprofit
Hi ,
Can someone advise EA Code for me about " how do closed all of order, after one of them hit takeprofit. or stoploss"
thank you in advance.
Jay..

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Happy new Year everyone.
Can someone give me a snippet of code, that will delete a un-used buystop/sellstop order?
For example, the ea I use, places a buystop order and a sellstop order, 10 pips away from the current price. If one of the orders(buy or sell stop) is filled, I want the other un-used order to be deleted.
Can anyone help me?
Thanks
Altern8