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

Re: [Metastockusers] Drawing Hourly High-Lo-Close lines on Intraday Charts



PureBytes Links

Trading Reference Links

US Galla


> Dear All,
>  I was looking if we can draw the Hourly high, Low and close lines on
> a intraday charts(tick, 1 min,5 min, 15 min,20 min,30 min). All maybe
> as seperate formulae i.e only the hrly high or low or close.
> Any help in this regard.
>
> Thanking you in anticipation
>
> U S Galla

Try this work-in-progress. All I ask is that you inform me of any problems that you encounter. This
indicator does not include tick or 20 minute capability. Other standard periodicies should be
detected automatically based on the highest Minute() value found in the chart. It's almost certain
that extreme data combinations will cause the indicator to fail, and these I would like to know
about.

You can create individual data arrays for each price by making copies of the indicator and naming
each copy appropriately. Any problems that arise are likely to be in the way the beginning and end
of each frame is constructed. Nominally the first bar of each hourly frame will be the first bar
after Minute()=0, and the last bar of each frame will be each Minute()=0 bar. In practice it is not
so easy to define each frame because of intermittent trading activity.

The "guts" of my indicator is the 'J' variable. This has a value of 1 for every Minute()=0 bar
(final bar of the frame), and a value of 2 where the completion of the frame is not detected until
the first bar of the next frame. Therefore 'J' signals whether to look at the current bar for the
required frame value or whether we should look instead at the previous bar. The 'M' and 'F'
variables equate to "Monday" and "Friday" bars for weekly frames, where 'M' signals the first bar of
the frame and 'F' signals the last bar.

With weekly data we always know when a new week starts because DayOfWeek() is less than the previous
DayOfWeek() even when the Monday bar is missing. The beginning of the frame is obvious even when the
end of the week may not be known owing to missing Friday data. With Hourly indicators on intraday
charts the situation is different because the change to a new hour signals the end of the current
frame rather than the beginning of a new frame. This different relationship between frame boundaries
is the biggest problem to overcome when creating hourly indicators for intraday charts.

Hope this helps.

Roy

  {Hourly OHLC}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
  {for use on 1 minute to hourly charts}
R:=Input("Display Mode,  0=Static  1=Dynamic  2=Test",0,2,0);
  {0=Display, update at last bar of hour}
  {1=Display, update on each new bar}
  {2=Backtest, update on first bar of new hour}
A:=Minute(); G:=LastValue(Highest(A)=0);
B:=LastValue(If(Highest(A)=59,1,
  If(Highest(A)=55,5,If(Highest(A)=50,10,
  If(Highest(A)=45,15,If(Highest(A)=40,20,
  If(Highest(A)=30,30,60)))))));
F:=Hour()=0 OR Hour()<>ValueWhen(2,1,Hour());
M:=DayOfWeek()<>ValueWhen(2,1,DayOfWeek()) OR
  (A=30)*(B=30) OR (A=15)*(B=15) OR G OR
  (A=10)*(B=10) OR (A=5)*(B=5) OR (F AND A<>0);
M:=M OR (M+F=0 AND Alert(F AND M=0,2)) OR (A=0 AND ValueWhen(2,1,A)=0);
F:=G OR (F AND M=0);
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+(R=1)=2,1,J);
J:=If(G,1,If(R=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)));
Oo:=ValueWhen(1,J,If(J=1,ValueWhen(1,M,O),
  ValueWhen(2-G,1,ValueWhen(1,M,O))));
Oo:=ValueWhen(1,Oo>0,Oo); {OPEN}
Ho:=ValueWhen(1,Ho>0,Ho); {HIGH}
Lo:=ValueWhen(1,Lo>0,Lo); {LOW}
K:=ValueWhen(1,K>0,K);  {CLOSE}
Oo; Ho; Lo; K;




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

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

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

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