kama
forge.tafunctionSince Forge API 1
Functionpython
forge.ta.kama(source: ArrayLike,period: int = 10,fast_period: int = 2,slow_period: int = 30) -> np.ndarrayKaufman adaptive average.
Parameters
| Name | Type | Default |
|---|---|---|
| source | ArrayLike | |
| period | int | 10 |
| fast_period | int | 2 |
| slow_period | int | 30 |
Indicator: Kaufman adaptive moving average
The smoothing constant is (er * (fast_sc - slow_sc) + slow_sc)^2 with er the efficiency
ratio over period bars and sc = 2 / (n + 1) for the fast and slow periods. NaN for the
first period bars of each unbroken run.
Classpython
forge.ta.KAMA(**inputs: Any) -> NoneAverage that speeds up when the price trends and slows down when it chops.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| period | int | 10 | 1 to 5000 |
| fast_period | int | 2 | 1 to 5000 |
| slow_period | int | 30 | 1 to 5000 |
sc = (ER * (fast_sc - slow_sc) + slow_sc)^2, with fast_sc = 2 / (fast_period + 1) and slow_sc = 2 / (slow_period + 1)
KAMA[i] = KAMA[i-1] + sc * (x[i] - KAMA[i-1]), seeded with x[period-1]
The first period values are left empty. After a gap the average starts again.