Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


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
 
Old 03-09-2007, 07:01 PM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-09-2007, 07:51 PM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
Here you can test simple version of it.
EURUSD only.
Initial-Stop 45...65 - optimum 60
TakeProfit 20 ... 35 - optimum 30
TF daily only.
Attached Files
File Type: ex4 ORBsV.ex4 (7.3 KB, 37 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-10-2007, 01:15 PM
Junior Member
 
Join Date: Sep 2006
Location: Indonesia
Posts: 8
jkancil is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 03-10-2007, 06:35 PM
Member
 
Join Date: Feb 2007
Posts: 30
justize is on a distinguished road
THANKS!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Bookmarks
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT. The time now is 07:27 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.