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 05-29-2006, 10:34 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
how to let the EA close all opening order of a specific symbol?

i tried this code

** totalprofit = all profit from floating orders**

if(totalprofit>300)CloseAll();

//------------------
void CloseAll()
{ int spread = MathRound((Ask-Bid)/Point);
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,spread,Bl ack);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,spread,Bl ack);
}
}
}
//-----------------------

it's dose'nt work .. what's wrong with it?..pls

anyone know pls help me.. , looking forward for kindly help

thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 05-29-2006, 04:36 PM
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
if you post the EA I can take a look at it. Also, post code within code brackets so that it is easy to read.

Also, look at this line ---> OrderClose(OrderTicket(),OrderLots(),Bid,spread,Bl ack);

it should be ---> OrderClose(OrderTicket(),OrderLots(),Bid,spread,Bl ack);

& this line ---> OrderClose(OrderTicket(),OrderLots(),Ask,spread,Bl ack);

should be ---> OrderClose(OrderTicket(),OrderLots(),Ask,spread,Bl ack);

Last edited by Maji; 05-29-2006 at 05:58 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 05-29-2006, 05:26 PM
firedave's Avatar
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
To close all trade start from latest ID :
PHP Code:
for (int cnt total-cnt >=cnt--) 
. Hope this help
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 05-29-2006, 06:29 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Give this article a look:
http://www.metatrader.info/node/99
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 05-30-2006, 05:08 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
here's the new one but still doesn't work
Attached Files
File Type: mq4 closeall.mq4 (1.3 KB, 23 views)
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EA to close all open order of GBPJPY hedge4x Expert Advisors - Metatrader 4 3 12-22-2007 02:34 PM
How to add symbol ? mastri Metatrader 4 1 10-05-2006 03:22 PM
Close All Order when Profit.... FXfish Metatrader 4 1 08-15-2006 03:43 PM
How to close an open order after X hours? Maji Metatrader 4 2 03-18-2006 01:14 AM


All times are GMT. The time now is 10:51 PM.



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