Moving Average - Kaufman’s Adaptive (KAMA)

View as Markdown

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(ISeries\<double\> input, int fast, int period, int slow)

Returns default value

KAMA(int fast, int period, int slow)[int barsAgo]

KAMA(ISeries\<double\> 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

ParameterDescription
fastFast length
inputIndicator source data (Series<T>)
periodNumber of bars used in the calculation
slowSlow length

Examples

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

Source Code

You can view this indicator method source code by selecting the menu New > NinjaScript Editor > Indicators within the NinjaTrader Control Center window.