Alex,
CMO is
easier to calculate than RSI.
Try
-----
#include <cmo.afl>
Len = Param("cLen",8,3);
Plot(CMO(C,Len), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
ob = Param("OB",50); os = Param("OS",-50,-100,0);
Plot(ob,"",colorRed);
Plot(os,"",colorBrightGreen);
Len = Param("cLen",8,3);
Plot(CMO(C,Len), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
ob = Param("OB",50); os = Param("OS",-50,-100,0);
Plot(ob,"",colorRed);
Plot(os,"",colorBrightGreen);
Where
cmo.afl is
-------
function cmo(pr, len)
{
num = pr - Ref(pr,-1);
den = abs(num);
result = 100*(Sum(num,len)/Sum(den,len));
return result;
}
{
num = pr - Ref(pr,-1);
den = abs(num);
result = 100*(Sum(num,len)/Sum(den,len));
return result;
}
------
I use
the include for other CMOs such as CompCMO
-----
#include <cmo.afl>
Len1 = Param("CMO1L",5,3); Len2 = Param("CMO2L",8,3); Len3 = Param("CMO3L",13,3);
CompCMO = (CMO(C,Len1)+CMO(C,Len2) +CMO(C,Len3))/3;
Len1 = Param("CMO1L",5,3); Len2 = Param("CMO2L",8,3); Len3 = Param("CMO3L",13,3);
CompCMO = (CMO(C,Len1)+CMO(C,Len2) +CMO(C,Len3))/3;
Plot(CompCMO,_DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
ob = Param("OB",50); os = Param("OS",-50,-100,0);
Plot(ob,"",colorRed);
Plot(os,"",colorBrightGreen);
ob = Param("OB",50); os = Param("OS",-50,-100,0);
Plot(ob,"",colorRed);
Plot(os,"",colorBrightGreen);
-----
Regards,
Bob
Regards,
Bob
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of alex huynh
Sent: Wednesday, April 05, 2006 2:03 AM
To: [email protected]
Subject: [amibroker] Momentum IndexHi,I am missing a piece of puzzle (A of B) to complete translate code. anyone reproduce similiar to the code greatly appreciate. I'm trying to get into Momentum Index.Regards,Alex//Chande's Momentum Oscillator IIperiods=Param("Periods",14,5,30,1);//{define an up Day AND down Day}upday=IIf(C>Ref(C,-1),C-Ref(C,-1),0);downday=IIf(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}CD=100*(sumup-sumdown)/(sumup+sumdown);///////////////////////////////////////Momentum IndexPD= Param("Lookback Period",30, 5, 220, 1);MI= {Chande Momentum Osc (C,PD)}((Sum(IIf(Close,>,Ref(Close,-1), (Close-Ref(Close,-1)),0),pd)) -(Sum(IIf(Close,<,Ref(Close,-1), (Ref(Close,-1)- Close),0),pd))) /((Sum(IIf(Close,>,Ref(Close,-1), (Close-Ref(Close,-1)),0),pd) +(Sum(IIf(Close,<,Ref(Close,-1), (Ref(Close,-1)- Close),0),pd))))*100; // problem start here
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1ยข/min.
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
Investment management software Real estate investment software Investment property software Software support Real estate investment analysis software Investment software
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
