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
|
|
|
|
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 ;
|
|
|
|
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?
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 9/2/2010(UTC) Posts: 11 Location: South Africa
|
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
|
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
|
|
|
|
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]
|
|
|
|
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?
|
|
|
|
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)
|
|
|
|
|
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.