MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Chande's Momentum Oscillator II
From: tonikarhu <tonikarhu / at / yahoo.com> <tonikarhu / at / yahoo.com>
To: Metastockusers / at / yahoogroups.com <Metastockusers / at / yahoogroups.com>
Date: Saturday, February 8, 2003, 4:24:57 PM
Subject: [Metastockusers] Different timeframes

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??

thanks,

toni

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

From: Roy Larsen <rlarsen / at / man.quik.co.nz>
To: Metastockusers / at / yahoogroups.com <Metastockusers / at / yahoogroups.com>
Date: Sunday, February 9, 2003, 10:25:12 PM
Subject: [Metastockusers] Different timeframes

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??

A 5 week CMO would sample data only on the last day of the week. This is not quite as straightforward as one might think, but it can be done. First one needs to have an accurate breakdown of how the CMO is constructed. I have some code that appears to be the prerequisite for a normal data array so I'll take it further when I get a moment (24-48 hours).

Roy

Here is the standard CMO (source unknown).


Chande's Momentum Oscillator II

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

 


Chande's Momentum Oscillator - Weekly 4 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);

 

Source / From: TOP
EquisMetastock[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!