NinjaScript > Language Reference > Indicator Methods >

Moving Average - Kaufman's Adaptive (KAMA)

Print this Topic Previous pageReturn to chapter overviewNext page

Description

Developed by Perry Kaufman, this indicator is an EMA using an Efficiency Ratio to modify the smoothing constant, which ranges from a minimum of Fast Length to a maximum of Slow Length.

 

 

Syntax

KAMA(int fast, int period, int slow)
KAMA(IDataSeries input, int fast, int period, int slow)

 

Returns default value
KAMA(int fast, int period, int slow)[int barsAgo]
KAMA(IDataSeries input, int fast, int period, int slow)[int barsAgo]

 

 

Return Value

double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.

 

 

Parameters

fast

Fast length

input

Indicator source data (?)

period

Number of bars used in the calculation

slow

Slow length

 

 

Examples

// Prints the current value of a 20 period KAMA using default price type
double value = KAMA(2, 20, 30)[0];
Print("The current KAMA value is " + value.ToString());

 

// Prints the current value of a 20 period KAMA using high price type
double value = HMA(High, 2, 20, 30)[0];
Print("The current KAMA value is " + value.ToString());

 

 

Source Code

You can view this indicator method source code by selecting the menu Tools > Edit NinjaScript > Indicator within the NinjaTrader Control Center window.