PureBytes Links
Trading Reference Links
|
> Many thanks for the good job Roy!
> If I want other periods of ATR , i simple change that,
> in that point?
>
> {A;} {ATR(6);}
> {B;} {ATR(5);}
> LONG:=(B*0.6)+K;
> SHORT:=K-(A*0.6);
> LONG;SHORT;
No it's not quite as simple as that. "A" and "B" are currently ATR(6) and ATR(5) respectively
Try this. I've added a 'D' and 'Y' variable to make the second ATR(D) independant of ATR(N). Because
I've exceed the 20 variable limit I've had to change the "Long" and "Short" variable names and they
are now called 'X' and 'Y'.
Don't forget that to have an accurate 5 day ATR() you need about 25 days of historical data. If you
have less data then the ATR() values will be off.
Roy
{Modified Daily ATR}
{for use on intraday charts}
{© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
N:=Input("First ATR Periods" ,1,99,6);
X:=1/N;
D:=Input("Second ATR Periods",1,99,5);
Y:=1/D;
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=DayOfMonth()<>ValueWhen(2,1,DayOfMonth());
M:=G OR I;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+Q=2,1,(B=0)*J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
K:=ValueWhen(1,K>0,K); Ci:=ValueWhen(2,J,K);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<=N,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
A:=If(ValueWhen(N+1,J,A)>0,A,A);
B:=If(Cum(J>0)<=D,Cum((J>0)*R)/D, ValueWhen(1,J,PREV)*(1-Y)+R*Y);
B:=If(ValueWhen(N,J,B)>0,B,B);
{A;} {ATR(N);}
{B;} {ATR(D);}
X:=K+(B*0.6); {Long}
Y:=K-(A*0.6); {Short}
X; Y;
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|