logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Johandk  
#1 Posted : Wednesday, September 15, 2010 12:55:43 PM(UTC)
Johandk

Rank: Member

Groups: Registered, Registered Users
Joined: 9/2/2010(UTC)
Posts: 11
Location: South Africa

Hi. How can I code an Expert advisor to exit on a 3times ATR trailing stop? The formula I want to use is H-3*ATR(10) So when the entry signal occurred I would like the expert advisor to work out a 3*ATR from the entry signal’s high. Thank you
henry1224  
#2 Posted : Wednesday, September 15, 2010 1:23:07 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
you have to develop a latch type of system

Long_entry:={your entry};
Long_exit:={long exit};
Short_Entry:={your short entry};
Short_exit:={your short exit};

Define those conditions then use the forum dll to form a Latch

or define a long_condition and a short_condition

Signal:=Long-short ;

Johandk  
#3 Posted : Wednesday, September 15, 2010 2:05:10 PM(UTC)
Johandk

Rank: Member

Groups: Registered, Registered Users
Joined: 9/2/2010(UTC)
Posts: 11
Location: South Africa

I tried this LE:={entry condition}; LX:=C<h-3*ATR(10); Z:= ExtFml( "Forum112.Latch", LE, LX, 0, 0); EnterLong:=Z = 1 AND Ref(Z,-1) 1; ExitLong:=Z = 0 AND Ref(Z,-1) = 1; EnterLong-ExitLong; It works but the long exit(LX) doesnt work. I want the ATR to be calculated from the entry and it doesnt seem if the latch function does it? Any help?
Johandk  
#4 Posted : Wednesday, September 15, 2010 2:07:36 PM(UTC)
Johandk

Rank: Member

Groups: Registered, Registered Users
Joined: 9/2/2010(UTC)
Posts: 11
Location: South Africa

Sorry the LX:= C
Johandk  
#5 Posted : Wednesday, September 15, 2010 2:09:17 PM(UTC)
Johandk

Rank: Member

Groups: Registered, Registered Users
Joined: 9/2/2010(UTC)
Posts: 11
Location: South Africa

Sorry the formula doesnt want to paste. The LX:= high minus 3times ATR must be smaller than the close
wabbit  
#6 Posted : Wednesday, September 15, 2010 9:35:59 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Download Richard Dale's free advanced stop dll : http://www.tradernexus.com/advancedstop/advancedstop.html
Johandk  
#7 Posted : Wednesday, September 15, 2010 11:28:30 PM(UTC)
Johandk

Rank: Member

Groups: Registered, Registered Users
Joined: 9/2/2010(UTC)
Posts: 11
Location: South Africa

Thanks Wabbit I did download the advanced stop but I dont know how to program the stages in expert advisor. I know I must somehow use the Stagelong function but I dont fully understand all the "stuff" I must enter into it ExtFml( "AdvancedStop.StageLong", Entry Condition, Initial Stop at Entry, Transition to breakeven/TPS, TPS, First Pyramid Condition, TPS at First Pyramid, Second Pyramid Condition, TPS at Second Pyramid) What must I put in? e.g must I type in by initial stop 3times ATR and by first pyramid condition=5timesATR(asuming I'm using a 3TimesATR stop and a 5timesATR pyramiding entry) Thank you for your patience
wabbit  
#8 Posted : Thursday, September 16, 2010 6:30:09 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)

USAGE

After installation, a DLL file called AdvancedStop is stored in your equis\metastock\external formula dlls directory. The Advanced Stop DLL has four functions that can be called:

StopLong - the trailing profit stop on a long trade
StopShort - the trailing profit stop on a short trade
StageLong - the stage of the trade in a long trade
StageShort - the stage of the trade in a short trade

All of the above functions take the following parameters:
Entry Condition - what causes an entry (eg. a particular date, moving average crossover etc.)
Initial Stop at Entry - The stop point when you enter the trade
Transition to breakeven stop - The price at which you transition to a breakeven point (calculated on day of entry) - set this to 0 if you do not want to use a breakeven stop.
Trailing Profit Stop - The value of the trailing profit stop, calculated on each day of the trade.
First Pyramid Condition - The price at which you transition to the first pyramid condition (calculated on day of entry). Set this to 0 if you do not want to use a pyramid
Trailing Profit Stop at First Pyramid - The value of the trailing profit stop, calculated on each day of the trade, after the first pyramid point has been signalled. Set to 0 if you do not want to use this.
Second Pyramid Condition - The price at which you transition to the first pyramid condition (calculated on day of entry). Set this to 0 if you do not want to use a pyramid
Trailing Profit Stop at Second Pyramid - The value of the trailing profit stop, calculated on each day of the trade, after the second pyramid point has been signalled. Set to 0 if you do not want to use this.




wabbit [:D]


Mark17  
#9 Posted : Wednesday, September 22, 2010 4:22:38 AM(UTC)
Mark17

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/25/2010(UTC)
Posts: 55

The top one says: > AdvancedTrailingStop v1.1 for Metastock v8.X or v9.X or v10.x (156K download) Does it work for v11, too?
wabbit  
#10 Posted : Wednesday, September 22, 2010 6:30:44 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
AFAIK, yes.


wabbit [:D]

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.