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

Re: Multiple time frames



PureBytes Links

Trading Reference Links


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;
> > 
> > 
> > I am currently working with some code with the WEEKDAY function 
to
> > > determine the previous week start and end and proceed from 
there.
> > > Thanks for the code though. Will come in handy for sure. 
> > >