Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

KCCI - Adaptive CCI v2.0 by Karthimarar for Amibroker (AFL)
kaiji
almost 15 years ago
Amibroker (AFL)

Rating:
4 / 5 (Votes 5)
Tags:

This is a very good version of the CCI indicator developed by Karthimarar.

Screenshots

Indicator / Formula

Copy & Paste Friendly
// KCCI - Adaptive CCI by Karthimarar
// Details at website www.tatechnics.in
_SECTION_BEGIN("Dominant Period");
   
    SetBarsRequired( 1000, 1000);
    prc = ( High + Low ) / 2;
    Cyclepart = 0.7 ;
    Smooth[0] = Detrender[0] = I1[0] = Q1[0] = jI[0] = jQ[0] = I2[0] = Q2[0] = Re[0] = Im[0] = Period[0] = SmoothPeriod[0] = 0;
    for ( i = 6; i < BarCount; i++ )
    {
    Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10;
    AmpCorr[i] = 0.075 * Period[i-1] + 0.54;
    Detrender[i] = ( 0.0962 * Smooth[i] + 0.5769 * Smooth[i-2] - 0.5769 * Smooth[i-4] - 0.0962 * Smooth[i-6] ) * AmpCorr[i];
    Q1[i] = ( 0.0962 * Detrender[i] + 0.5769 * Detrender[i-2] - 0.5769 * Detrender[i-4] - 0.0962 * Detrender[i-6] ) * AmpCorr[i];
    I1[i] = Detrender[i-3];
    jI[i] = ( 0.0962 * I1[i] + 0.5769 * I1[i-2] - 0.5769 * I1[i-4] - 0.0962 * I1[i-6] ) * AmpCorr[i];
    jQ[i] = ( 0.0962 * Q1[i] + 0.5769 * Q1[i-2] - 0.5769 * Q1[i-4] - 0.0962 * Q1[i-6] ) * AmpCorr[i];
    I2[i] = I1[i] - jQ[i];
    Q2[i] = Q1[i] + jI[i];
    I2[i] = 0.2 * I2[i] + 0.8 * I2[i-1];
    Q2[i] = 0.2 * Q2[i] + 0.8 * Q2[i-1];
    Re[i] = I2[i] * I2[i-1] + Q2[i] * Q2[i-1];
    Im[i] = I2[i] * Q2[i-1] - Q2[i] * I2[i-1];
    Re[i] = 0.2 * Re[i] + 0.8 * Re[i-1];
    Im[i] = 0.2 * Im[i] + 0.8 * Im[i-1];
    if ( Im[i] != 0 AND Re[i] != 0 )
    Period[i] = 360 / atan( Im[i] / Re[i] );
    if ( Period[i] > 1.5 * Period[i-1] )  Period[i] = 1.5 * Period[i-1];
    if ( Period[i] < 0.67 * Period[i-1] ) Period[i] = 0.67 * Period[i-1];
    if ( Period[i] < 6 )
    Period[i] = 6;
    if ( Period[i] > 50 )
    Period[i] = 50;
    Period[i] = 0.2 * Period[i] + 0.8 * Period[i-1];
    SmoothPeriod[i] = 0.33 * Period[i] + 0.67 * SmoothPeriod[i-1];
    }
_SECTION_END();

_SECTION_BEGIN("Variable period CCI");
function MeanDev( array, mean, range )
{
  result = 0;

   for( i = LastValue( range ) ; i < BarCount; i++ )
   {
      result[ i ] = 0;
      // the mean is not 'moving' over the range (outside the loop)
      tm = mean[ i ];
      for( j = 0; j < range[ i ] AND ( i - j ) >= 0 AND ( i - j ) < BarCount; j++ )
      {
        result[ i ] = result[ i ] + abs( array[ i - j ] - tm );
      }
    
    result[ i ] = result[ i ]/range[ i ];
  }
  
  return result;
}

function VarCCI( array, period )
{

SMATP = MA(array,period );//1,2

 MD = MeanDev( array, SMATP, period  );

 KCCI = (Avg - SMATP) / (0.015 * MD);

 return KCCI;

}
sp=int(SmoothPeriod*Cyclepart);
lcol = IIf( VarCCI(Avg, Sp) > Ref( VarCCI(Avg, Sp), -1 ), IIf( VarCCI(Avg, Sp) > 0, 27, 27 ), IIf( VarCCI(Avg, Sp) > 0, 32,32 ) );// 27 43 11 32
//mcol =IIf(VarCCI(Avg, Sp)>0,colorGreen,colorRed);
Plot(VarCCI(Avg, Sp),"KCCI",lcol,2|styleThick);
Plot(VarCCI(Avg, Sp),"",lcol,1|styleThick);

1 comments

1. karrgk

This one looks good but is too heavy. The amibroker is getting too slow. Its using a lot resources. Again after removing its working well. Plsss look in to this….

Leave Comment

Please login here to leave a comment.

Back