Keltner channel and STARC - FXB.ta.Keltner

The FXB.ta.Keltner class calculates a Keltner channel: a moving average plus/minus ATR. Changing the default maType from EMA to SMA in effect turns the Keltner channel into a Stoller channel (STARC). It is a bar-based calculation (because it uses ATR), and requires candle data as an input. Parameters are as follows:

Parameter

Description

maPeriod

Period for the moving average which forms the centre of the channel (defaulting to 20)

maType

Type of moving average. Defaults to an exponential moving average (ema / 1).

atrPeriod

Period for the ATR calculation (doesn't have to be same as the moving-average period, and separately defaults to 10)

atrMultiple

Multiple of the ATR value for calculating the upper and lower bands (defaults to 2)

The primary output value - GetValue() - of the calculation is the moving average. The calculation also sets the signal value - GetSignalValue() - to the ATR value. And the calculation provides some helper functions for getting the upper and lower bands:

Parameter

Description

GetUpper(idx)

Gets the upper band at index #idx: the main value plus the atrMultiple parameter times the signal value

GetLower(idx)

Gets the lower band at index #idx: the main value minus the atrMultiple parameter times the signal value

GetUpperArray()

Returns an array of all upper-band values

GetLowerArray()

Returns an array of all lower-band values