[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Re: 25 % trailing stop?



PureBytes Links

Trading Reference Links

Download AdvancedStop.dll by Richard Dale, free from:
http://www.tradernexus.com/advancedstop/advancedstop.html

MetaStock -> Tools -> Indicator Builder -> New
Copy and paste formulae below.

jose '-)


====================================
Trailing Stop - AdvTrailStop plug-in
====================================
---8<-------------------------------

{ Plot on price chart }
{ Triggers: Long (+1) & Short (-1) signals at
  crossover of user-defined trailing stops }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }

{ AdvancedStop.dll must be in
 ...\MetaStock\External Function DLLs\ folder }
{ AdvancedStop.dll by Richard Dale, free from:
http://www.tradernexus.com/advancedstop/advancedstop.html }

buffer1:=
 Input("initial stop % buffer",0,100,25)/100;
buffer2:=
 Input("trailing stop % buffer",0,100,25)/100;
plot:=Input("plot:  trailing stop=1,  Long+Short=2,  signals=3",1,3,1)
;
adv:=Input("plot:  today's trailing stop=0,  tomorrow's stop=1",0,1,0)
;
delay:=Input("Entry and Exit signal delay",
 0,5,0);

entrySignal:=C=C;
initialStopLong:=C*(1-buffer1);
trailStopLong:=C*(1-buffer2);
stopLong:=ExtFml("AdvancedStop.StopLong",
 entrySignal,initialStopLong,0,trailStopLong,
 0,0,0,0);

exitSignal:=Cross(stopLong,C);
initialStopShort:=C*(1+buffer1);
trailStopShort:=C*(1+buffer2);
stopShort:=ExtFml("AdvancedStop.StopShort",
 exitSignal,initialStopShort,0,trailStopShort,
 0,0,0,0);

entrySignal:=Cross(C,stopShort);
stopLong:=ExtFml("AdvancedStop.StopLong",
 entrySignal,initialStopLong,0,trailStopLong,
 0,0,0,0);

In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
flag:=BarsSince(Init OR In)
 < BarsSince(Init OR Out)+(Cum(In)=1);
signals:=Ref(((Cum(In)=1)
 AND Alert((Cum(In)=1)=0,2)
 OR flag AND Alert(flag=0,2))
 +(flag=0 AND Alert(flag,2))*-1,-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);

If(plot=1,stop,
 If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
 If(plot=2,Ref(stopShort,-1+adv),signals))

---8<-------------------------------



--- In Metastockusers@xxxxxxxxxxxxxxx, "tradetofreedom" 
<tradetofreedom@xxxx> wrote:
> Hi!
> 
> How can I write a 25 % trailing stop -indicator? If I just write C - 
> (Ref(C,-1 )*0,25) it is ok but the stop just moves up and down with 
> the price =)
> How can I prevent that? How to write an indicator that doesn't move 
> down, only sideways or up??
> 
> Thanks!



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
     Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/