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

Re: [Metastockusers] Different timeframes



PureBytes Links

Trading Reference Links

Toni

> How can I use different timeframes in the system tester, for instance
> if I wanted a weekly CMO and a Dayly CMO the dayly 5 day would be
>
> CMO(C,5)
>
> but chat would a 5 week CMO be like??

Here is the standard CMO (source unknown).

  {Chande Momentum Oscillator}
periods:=Input("Periods",5,30,14);
  {define an up day and down day}
upday:=If(C>Ref(C,-1),C-Ref(C,-1),0);
downday:=If(Ref(C,-1)> C,Ref(C,-1)-C,0);
  {sum up the up and down days over the given period}
sumup:=Sum(upday,periods);
sumdown:=Sum(downday,periods);
  {define the CMO}
100*(sumup-sumdown)/(sumup+sumdown);


>From that indicator structure a weekly CMO for daily charts can be
constructed. The following example does NOT have a dynamic current week, and
neither will it update until Monday data is added if Friday data is missing.
Both of these issues can be easily addressed but for normal over-the-weekend
analysis this indicator will return the weekly CMO value when used in daily
explorations.

Please understand that this is not intended to be the ultimate solution but
it is simply an example of a basic weekly CMO for daily charts.

Roy

  {Weekly CMO} {for Daily Charts}
Pd:=Input("Periods in Weeks",1,99,10);
F:=DayOfWeek()=5; {Friday}
M:=DayOfWeek()<=Ref(DayOfWeek(),-1); {Monday}
Ew:=If(F,1,If(Alert(F,2)=0 AND M,2,0)); {end of week}
C0:=ValueWhen(1,Ew,If(Ew=1,C,Ref(C,-1)));
C1:=ValueWhen(2,Ew,If(Ew=1,C,Ref(C,-1)));
Ud:=If(C0>C1,C0-C1,0); {up week}
Dd:=If(C0<C1,C1-C0,0); {down week}
U:=Cum(If(Ew>0,Ud,0))-ValueWhen(Pd+1,Ew,Cum(If(Ew,Ud,0))); {sum of up weeks}
D:=Cum(If(Ew>0,Dd,0))-ValueWhen(Pd+1,Ew,Cum(If(Ew,Dd,0))); {sum of down
weeks}
100*(U-D)/(U+D);



To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

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