Rank: Newbie
Groups: Registered, Registered Users Joined: 10/16/2011(UTC) Posts: 9
|
Here's a slightly modified version of ST. Uses MovAvgs of high & low instead of Median price. Added ability to enter a start date which I like for when I open a new position.
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1900,2050,2014);
Entry:=DayOfMonth() = InpDay AND Month() = InpMonth AND Year() = InpYear;
Factor:=Input("Factor",1.00,10.00,3.00);
Pd:=Input("ATR Periods",1,500,21);
Up:=Mov(H,21,S)+(Factor*(ATR(Pd)));
Dn:=Mov(L,21,S)-(Factor*(ATR(Pd)));
Td:=If(Cross(C,LLV(Up,13)),1,If(Cross(HHV(Dn,13),C ),-1,PREV));
Dnx:=If(Dn=HighestSince(1,Cross(Td,0),Dn),Dn,PREV) ;
Upx:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,PREV);
ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
If(BarsSince(Entry)=0,ST,ST);
And a version that uses HHV & LLV for past 3 months instead of median price.
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1900,2050,2014);
Entry:=DayOfMonth() = InpDay AND Month() = InpMonth AND Year() = InpYear;
Factor:=Input("Factor",1.00,10.00,3.00);
Pd:=Input("ATR Periods",1,500,63);
Up:=HHV(H,63)+(Factor*(ATR(Pd)));
Dn:=LLV(L,63)-(Factor*(ATR(Pd)));
Td:=If(Cross(C,LLV(Up,13)),1,If(Cross(HHV(Dn,13),C ),-1,PREV));
Dnx:=If(Dn=HighestSince(1,Cross(Td,0),Dn),Dn,PREV) ;
Upx:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,PREV);
ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
If(BarsSince(Entry)=0,ST,ST); Edited by user Monday, December 22, 2014 3:14:11 AM(UTC)
| Reason: Not specified
|