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

Re: How to use EOD data to get weekly info?



PureBytes Links

Trading Reference Links

Thank you very much, Anthony. It helps a lot. 

I do have a question. I load your formula and run to explore against 
KO for 150 bars (30 weeks). I get one crossing on June 21 while if I 
run an AFL codes( x=(O+H+L+C)/4; y=ema(x,40); plot(x,"",1,1);plot
(y,"",3,1);) to weekly data I get at least two crossings on March 8 
and July 12. Why this happen?

After I change from 40 bars to 200 bars(40 weeks) for the filter, 
(the code: Filter=Cross(weekly_avg, EMA (weekly_avg,200));)
I get March 8 crossing but no July 12 crossing. Do you have any idea? 
Thanks a lot.

Greg Liu




--- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> Greg,
> 
> The last post had an unwanted line of code in it. Try this formula, 
this
> uses up to current data.
> 
> /****************************************/
> 
> LastBar = Cum(1)==LastValue(Cum(1));
> 
> WeeklyOpen=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1)OR 
Lastbar ,Open);
> 
> Weeklyhigh=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1)OR 
Lastbar,High);
> WeeklyLow=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1)OR 
Lastbar ,Low);
> WeeklyClose=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1)OR
> Lastbar,Close);
> 
> Weekly_avg=(WeeklyOpen+Weeklyhigh+WeeklyLow+WeeklyClose)/4;
> 
> Filter=Cross(weekly_avg, EMA (weekly_avg,40) );
> 
> AddColumn( weekly_avg, "weekly_avg" );
> AddColumn( EMA (weekly_avg,40), "ema (weekly_avg,40)" );
> 
> Anthony
> 
> 
> "Greg Q. Liu" wrote:
> 
> > I try to write an AFL fomula to scan weekly crossing for 4 week
> > periods by using daily data
> > as weekly_avg=
(weekly_high+weekly_low+weekly_open+weekly_close)/4;filter=cross
(weekly_avg,
> > ema (weekly_avg,40) );addcolumn( 
weekly_avg, "weekly_avg" );addcolumn(
> > ema (weekly_avg,40), "ema (weekly_avg,40)" ); But I only have 
daily
> > data, how this can be done? Thanks. GL
> >
> >
> > Yahoo! Groups Sponsor
> ADVERTISEMENT
> 
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.