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

Adaptive CCI Oscillator for Amibroker (AFL)

Rating:
4 / 5 (Votes 4)
Tags:
oscillator, amibroker

Adaptive CCI Oscillator can be used to determine the direction of the trend…And also it is of importance to find out divergences on the stocks…Good trades for all…

Screenshots

Similar Indicators / Formulas

3 Days Track
Submitted by janet0211 over 14 years ago
Trading Volume Statistic
Submitted by tuanstock1 over 10 years ago
Ergodic Oscillator
Submitted by dljtrader about 14 years ago
BoH Risk Aversion Indicator
Submitted by genkumag about 13 years ago
Chande Momentum Oscillator
Submitted by klimpek about 14 years ago
%R ++
Submitted by reb over 14 years ago

Indicator / Formula

Copy & Paste Friendly
_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);

////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN("OSCILLATOR"); 

SetChartBkColor(colorBlack); 

//AA=EMA(a,14)-EMA(a,42);
///BB=AA/EMA(a,42);
 
ifish=WMA(VarCCI(Avg,Sp),Sp);
upbar = ifish> Ref(ifish,-1); 
downbar = ifish < Ref(ifish,-1); 

barcolor2=IIf(ifish>0,IIf(ifish>Ref(ifish,-1),colorDarkGreen,colorYellow),IIf(ifish>Ref(ifish,-1),colorBlue,colorRed)); 

O = IIf(downbar, ifish, 0); 
C = IIf(downbar, 0,ifish); 
L=0; 
H = ifish; 
ColorHighliter = IIf(ifish>0,IIf(ifish>Ref(ifish,-1),colorDarkGreen,colorYellow),IIf(ifish>Ref(ifish,-1),colorBlue,colorRed)); 
SetBarFillColor( ColorHighliter ); 

barcolor = IIf(ifish<Ref(ifish,-1),colorRed,colorWhite); 

PlotOHLC( O,H,L,C, "Adaptive CCI OSCILLATOR", barcolor2, styleCandle,maskAll); 
_SECTION_END(); 

2 comments

1. Pascal SAMSON

Thanks; check also KCCI – Adaptive CCI v2.0 by Karthimarar, which is maybe better.
Regards,

2. godisbogus

I simply love this one man. Thanks a lot for sharing. This is better than KCCI-Adaptive CCI v2.0

Leave Comment

Please login here to leave a comment.

Back