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

Re: [EquisMetaStock Group] Writing indicator for the opening range.



PureBytes Links

Trading Reference Links

Vinit

> CAn any one help me withe following....
>
> on the 5 min chart i would like to calculate the
> average true range of the last ten days for the
> opening bar on the 5 min chart.
>
> This will help me a long way in trying to program Toby
> Crabels opening price principle.

This might do the trick for you. You'll need about 10 weeks of data to get a reasonably accurate 10
day ATR(). You'll see what I mean if you plot this indicator and the MetaStock ATR() on the same
daily periodicy chart. The problems with accuracy stem from the difficulty in starting daily data
right at the beginning of an intraday chart, and this is compounded by the use of Wilders Smoothing.
The use of a Simple Moving Average for smoothing would give an accurate 10 day smoothed ATR after 12
or 13 days. Obviously the indicator would need to be changed to do that, and it would different
readings from a "normal" ATR() anyway.

Roy

  {Daily ATR Basic}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
  {for use on intraday charts}
N:=Input("Daily ATR Periods",1,99,10); X:=1/N;
G:=LastValue(Highest(Sum(DayOfWeek()<>
   ValueWhen(2,1,DayOfWeek()),5))=5);
J:=DayOfMonth()<>ValueWhen(2-G,1,DayOfMonth()) OR G;
Oo:=ValueWhen(2-G,J,O);
Ho:=ValueWhen(1,J,ValueWhen(2-G,1,HighestSince(1,J,H)));
Ho:=ValueWhen(1,Ho>0,Ho);
Lo:=ValueWhen(1,J,ValueWhen(2-G,1,LowestSince(1,J,L)));
Lo:=ValueWhen(1,Lo>0,Lo);
K:=ValueWhen(1,J,ValueWhen(2-G,1,C));
Hi:=ValueWhen(2,J,Ho);
Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(2,J,K);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
If(ValueWhen(N+1,J,A)>0,A,A);




 
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/