PureBytes Links
Trading Reference Links
|
Hi Larry,
Everything would be OK if every trading week had
a) a Friday
b) 5 trading days
But trading weeks do not always have a) and/or b).
In such a case you will miss some values.
Dimitris Tsokakis
--- In amibroker@xxxx, "Yahoo" <lazza@xxxx> wrote:
> Here is another one for previous weekly H and L and C on daily bars.
>
> I think this is correct?
>
> Regards,
>
> Larry
>
> /*Weekly OHLC on Daily Chart
>
> by Larry Lovrencic*/
>
> graphxspace=1;
>
> MaxGraph=4;
>
> Graph0 =Close;
>
> Hw=ValueWhen( DayOfWeek() == 5, HHV(H, 5) );
>
> Graph1 =Ref(Hw,-1);
>
> Lw= ValueWhen( DayOfWeek() == 5, LLV(L, 5) );
>
> Graph2=Ref(Lw,-1);
>
> Cw=ValueWhen( DayOfWeek() == 5, Close );
>
> Graph3 =Ref(Cw,-1);
>
> Graph0Style=4+128;
>
> Graph0Color=29;
>
> Graph1Color=4;
>
> Graph1Style=4+8+16;
>
> Graph2Color=5;
>
> Graph2Style=4+8+16;
>
> Graph3Color=1;
>
> Graph3Style=4+128;
>
> Title = Date()+" "+Name()+" Wkly HLC on Dly" +" O"+WriteVal
(O,format=1.2)+"
> H"+WriteVal(H,format=1.2)+" L"+WriteVal(L,format=1.2)+"
> C"+WriteVal(C,format=1.2)+ " Wkly H=" + WriteVal(Graph1,format=1.2)
+" Wkly
> L="+WriteVal(Graph2,format=1.2)+" Wkly C="+WriteVal
(Graph3,format=1.2);
>
>
>
>
> -----Original Message-----
> From: nenapacwanfr [mailto:nenapacwanfr@x...]
> Sent: Monday, 10 December 2001 05:55
> To: amibroker@xxxx
> Subject: [amibroker] Re: Multiple time frames
>
>
>
>
> Dim,
>
> Dim,
>
> I have tried to plot and compares the two codes.
>
> B=DayOfWeek();
> G=BarsSince(B<Ref(B,-1));
> Hw=ValueWhen(B<Ref(B,-1),HHV(Ref(H,-1) ,Ref(G,-1)+1));
>
> this code gives the highest H of the previous week on Monday
> ( if monday is the first day )of the actual week
>
> Now if I plot
> B=DayOfWeek();
> G=B<Ref(B,-1);
> HW=highest(H,G);
> gives you the high of the actual week,
> but you don't have the weekly bars of H
> on daily chart.
>
> steph
> > Cw=ValueWhen(B<Ref(B,-1),Ref(Close,-1));
> > gives every Monday (or every first working day of the week) the
> > close value for last Friday (or the last working day of previous
> week)
> > and keeps this value till the end of the week.
> > As for Hw and Lw is quite different from the question.
> > Try to plot them and you will see.
> > Dimitris Tsokakis
> > --- In amibroker@xxxx, "nenapacwanfr" <nenapacwanfr@xxxx> wrote:
> > > HI,
> > > Do you think this could do the job
> > >
> > > steph
> > >
> > > /***Weekly Bars***/
> > > B=DayOfWeek();
> > > G=BarsSince(B<Ref(B,-1));
> > >
> > > Hw=ValueWhen(B<Ref(B,-1),HHV(Ref(H,-1) ,Ref(G,-1)+1));
> > > Lw=ValueWhen(B<Ref(B,-1),LLV(Ref(L,-1) ,Ref(G,-1)+1));
> > > Cw=ValueWhen(B<Ref(B,-1),Ref(Close,-1));
> > >
> > > Graph0=Close;
> > > Graph0Color=1 ;
> > > Graph0Style=64;
> > >
> > > Graph1=CW;
> > > Graph1Color= 5 ;
> > > Graph1Style=1;
> > >
> > >
|