Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi kaushik
Im not sure if you're asking for an expert or an exploration so my response may not be appropriate. However, I'm going to assume that you want an exploration. Assuming that your formula is named "My Trailing Stop" then your exploration could be as follows. You may or may not want to use the filter. I suggest you load 200 or more data bars, and DO NOT use Minimum Records.
{ColA:} TS:=Fml("My Trailing Stop"); If(Cross(C,TS),1,If(Cross(TS,C),-1,0));
{Filter} colA
On looking at your formula I noticed that it doesn't need any of the four PREV functions. I suggest that you update the formula by removing all PREVs. The benefit is that your exploration will run considerably faster, as will virtually any other operation using the same formula. Here's my conversion. It's only been tested on one chart and could generate a longer N/A period than the original. Nevertheless I'm satisfied that it is logically correct and a suitable replacement for the original if you're inclined to eliminate the PREV functions.
{My Trailing Stop} Up:=MP()+(1.5*ATR(10)); Dn:=MP()-(1.5*ATR(10)); Ta:=If(Cross(C,LLV(Up,13)),1,0); Tb:=If(Cross(HHV(Dn,13),C),-1,0); Td:=If(Ta,1,If(Tb,-1,ValueWhen(1,Ta+Tb,Ta+Tb))); Dnh:=If( Dn=HighestSince(1,Cross(Td,0),Dn),Dn,0); Dnx:=If(Dnh,Dn,ValueWhen(1,Dnh,Dn)); Upl:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,0); Upx:=If(Upl,Up,ValueWhen(1,Upl,Up)); ST:=If(Td=1,Dnx,Upx); ST;
Roy
|