PureBytes Links
Trading Reference Links
|
Hi William,
Here you are load into AA and your setting can be in Daily mode. Also,
if you want to check the value of the MACD(), load into AA and click
explore, then scroll back with the silder control and you will see the
values match those that are returned.
Hope this helps.
Anthony
/*********Begin code*************/
weeklyperiods=5;//1 week back=1x5=5, 2weeks=2x5=10, etc.
WeeklyPrice=MACD();
WeeklyMACD=ValueWhen(DayOfWeek() > Ref(
DayOfWeek(),1),WeeklyPrice);//Current week.
Buy=IIf(WeeklyMACD > Ref(WeeklyMACD,-weeklyperiods)AND C <
Ref(C,-1),1,0);
Sell=IIf(WeeklyMACD < Ref(WeeklyMACD,-weeklyperiods)AND C >
Ref(C,-1),1,0);
Short=0;Cover=0;
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
Filter=1;
AddColumn(Buy,"Buy");
AddColumn(Sell,"Sell");
AddColumn(WeeklyMACD,"MACDWeek");
AddColumn(Ref(WeeklyMACD,-weeklyperiods),"MACDprior");
/********End Code**********************/
William Wong wrote:
>
>
> Hi Anthony,
>
> Thanks for the reply.
>
> The trading rule that I am trying to test is:
>
> if macd of current week > macd of previous week and today close <
> yesterday close then buy
>
> if macd of current week < macd of previous week and today close >
> yesterday close then sell
>
> Question is:
>
> How do I get macd on weekly data if the setting on AA is daily?
>
> Anthony Faragasso <ajf1111@xxxx> wrote:
>
> William,
>
> I have sent several posts concerning this very issue, I feel
> we should
> be able to override any system setting with hard code. The
> example code
> below may help to explain. Load into AA, n last qoutation,
> n=1, click
> explore.
>
> WeeklyPds=20;//
> WeeklyPrice=C;
> Weekly=ValueWhen(DayOfWeek() > Ref(
> DayOfWeek(),1),WeeklyPrice);
>
> Filter=1;
> AddColumn(weekly,"Weekly");
> AddColumn(Ref(weekly,-WeeklyPds),"");// This does not return
> the Close
> price 20
> weeks ago while in Daily mode, it is working in Days, so, to
> get the
> Close price 20 weeks ago you should * 5;
>
>
> williamwongys wrote:
>
> > I am trying to implement a daily trading rule that only
> uses buy
> > signals if the weekly trend is up and sell signals if the
> weekly
> > trend is down. How can I access the weekly data while
> backtesting on
> > daily data?
> >
> > William
> >
> >
> > Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of Service.
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
> -----------------------------------------------------------------------
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|