[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: CCI in AFL not the CCI function



PureBytes Links

Trading Reference Links

Here it is.  I think someone on the board had posted this code 
before.  

Something like:

Plot(VarCCI(Avg, 14), "CCIvar", colorGreen, styleLine);
Plot(CCI(14), "CCIstd", colorRed, styleLine);

should plot one line on top of the other perfectly.

-------------------


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  );

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

 return CCIx;
}

 


--- In amibroker@xxxxxxxxxxxxxxx, "angus_83210" <rduncan@xxx> wrote:
>
> Does anyone have the CCI Function in AFL.  I don't want the x = CCI
> (14);, I am after the complete function.
> 
> Thanks
> 
> Robert
>




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006