PureBytes Links
Trading Reference Links
|
//----------8<--------------------------------------------------
_SECTION_BEGIN("CCI");
periods = Param( "Periods", 14, 2, 200, 1 );
scaleCCI = StDev( CCI(periods) , 3 * periods); //scale CCI swing
rbCCI = 0.5 * ( 1 + tanh ( CCI(periods) / scaleCCI ) );
rbCCI = 100 * rbCCI; // CCI bound to [0,100]
//Plot( CCI( periods ), _DEFAULT_NAME(), ParamColor( "Color",
colorCycle ), ParamStyle("Style") );
Plot( rbCCI, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
_SECTION_END();
/* Since CCI swings fast beyond an interval [-1,1], tanh of CCI
would be always very close to its limiting values 1 and -1. To get a
nicer graph, one may normalize the swings. Here I have used a
normalization to StDev over 3*periods, just for illustration.
The result is bound to [0,100].
cheers-- */
//------------8<-------------------------------------------------
--- In amibroker@xxxxxxxxxxxxxxx, "ricko8294_98" <ricko@xxx> wrote:
>
> When I plot your code I get only 2 values - either plus 100 or
minus
> 100
>
> Rick
> --- In amibroker@xxxxxxxxxxxxxxx, "dalengo" <dalengo@> wrote:
> >
> > rangeboundCCI = 100 * tanh( CCI(period ))
> >
> > as I was suggesting here many moons ago.
> > cheers--
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "mrdavis9" <mrdavis9@> wrote:
> > >
> > > I would like to have a CCI(50) , and also a CCI(100) that
ranges
> > from Zero to 100, in lieu of the typical CCI range of negative
100
> to
> > positive 100.
> > >
> > > This formula balow comes from Investor/RT Tour
> > >
> > > ====================
> > > TP = (HI + LO + CL) / 3
> > > TP stands for Typical Price
> > >
> > > MATP = MA(TP, n)
> > > n = CCI Period
> > > MATP stands for Moving Average (Simple) of Typical Price
> > >
> > > where n = CCI Period
> > > MDTP stands for Mean Deviation of Typical Price
> > >
> > > CCI = (TP - MATP) / (MDTP * 0.015)
> > > =====================================
> > > I bet that Dingo knows how to change this formula so that it
> will
> > oscillate between zero and 100.
> > >
> > > Later Ron D.
> > >
> >
>
|