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

RE: [amibroker] Re: Relative Strength



PureBytes Links

Trading Reference Links

I forget it....


buffer:=Input("buffer % trailing stop",0,100,8);
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);

StLong:=C-C*buffer/100;
StShort:=C+C*buffer/100;
stopLong:=If(C<PREV,StLong,Max(StLong,PREV));
stopShort:=If(C>PREV,StShort,Min(StShort,PREV));

In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
 < BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=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))



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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

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