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 11-14-2006, 10:21 AM
Member
 
Join Date: Oct 2005
Posts: 34
yaniv_av is on a distinguished road
EA question

Hi all !

I have a quite simple question (I think...)
Suppose I have a EA that opens several trades - all with sepecific TP.
Now, I want that this EA will close all the other open trades, once one of the open trades will hit it's TP.
I want that this will happend also if the EA was stopped from some reason and then restart again (So keeping internal variable that save the last-open-trades is no good solution...)
How can I do that ?

10X !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-14-2006, 12:10 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by yaniv_av
Hi all !

I have a quite simple question (I think...)
Suppose I have a EA that opens several trades - all with sepecific TP.
Now, I want that this EA will close all the other open trades, once one of the open trades will hit it's TP.
I want that this will happend also if the EA was stopped from some reason and then restart again (So keeping internal variable that save the last-open-trades is no good solution...)
How can I do that ?

10X !
U should use HistoryTotal() function and
OrderOpenPrice - OrderClosePrice() for long
or
OrderClosePrice() - OrderOpenPrice for short

If the result will be > than 0 then it was positive trade
That check will work if u close trades ONLY BY TP.

But if u want to check exactly if your takeprofit level was hit at that order u should do it like this:
1) get OrderTakeprofit() level from history (eg. last trade)
2) get Order open and close time
3) check in that period if the High price (eg by highest high function) was >= or Low (with lowest low) was <= than your profit target.

Quite simple isn't it ?

Enjoy!
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
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
Question About EAs mikejody Tools and utilities 2 05-25-2007 11:59 PM
question evgeni1980 Questions 4 11-27-2006 01:32 PM
Another question, sorry. demag Questions 0 02-13-2006 06:34 PM


All times are GMT. The time now is 06:33 PM.



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