| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
|
|
LinkBack | Thread Tools |
|
|
|||
|
|||
|
Breakout-System - Cancel Order
Hi,
I need some help. I designed a simple Breakoutsystem, which generates two orders like the following: Ticket = OrderSend(Symbol(),OP_BUYSTOP,Lots,kauf_stopp_prei s,3,kauf_stopp_preis-anfangs_stopp,kauf_stopp_preis +TakeProfit*Point,NULL,Magic1,TradeTime+EndHour*60 *60,Blue); //TradeTime+EndHour*60*60 Ticket = OrderSend(Symbol(),OP_SELLSTOP,Lots,verkauf_stopp_ preis,3,verkauf_stopp_preis+anfangs_stopp,verkauf_ stopp_preis-TakeProfit*Point,NULL,Magic2,TradeTime+EndHour*60* 60,Red); //TradeTime+EndHour*60*60 So there are two order to get stopped into the market. If one of them gets executet, the other order must bedeleted. Can I delete an order by using the MagicNumber? If that works, can somebody tell me the code??? Thanks |
|
|
|||
|
|||
|
int mgc=87697;
int total=OrdersTotal(); bool cancelorder=false; for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if((OrderMagicNumber()==mgc) && (OrderType()==OP_BUY || OrderType()==OP_SELL)) cancelorder=true; } if(cancelorder) { for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if((OrderMagicNumber()==mgc) && (OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP)) OrderDelete(OrderTicket()); } } Last edited by jkancil; 03-10-2007 at 01:18 PM. |
| Bookmarks |
| Thread Tools | |
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| breakout system | ligerny | Suggestions for Trading Systems | 3 | 04-25-2008 09:14 AM |
| Breakout System | daet | Suggestions for Trading Systems | 3 | 02-22-2007 12:11 PM |