How is Kama calculated?

Kama calculation parameters data limitations.

Direct answer

Kama is usually calculated as a variable, self-adjusting moving average. In the most common formulation, each new value of Kama uses (1) the previous Kama value, (2) a smoothing factor that changes over time, and (3) the current price. That smoothing factor depends on how “efficiently” price has moved over a recent lookback window—often measured as the ratio between net price change and total absolute change.

Because there are different names and variants in practice, the safest way to verify what you’re using is to check the exact definition in the indicator settings you have (for example, the lookback length and the smoothing constants). The calculation below shows one widely used, stable structure; if your platform’s Kama uses different parameter names or a slightly different efficiency formula, the mechanical steps are similar but the constants may differ.

Mechanism and definition

A practical way to describe the mechanics is as a recursive smoothing process.

  1. Choose the input price series Kama is computed from a time series of prices. The “price” can be defined in different ways (for example, close price, typical price, or another derived series). Your input choice must match the implementation you want to reproduce.

Let P[t] be the selected price at time t.

  1. Set a lookback window and smoothing bounds A typical Kama uses:
  • Lookback length: N (how many periods are used to judge efficiency)
  • Fast smoothing setting: usually represented by a small “fast” period or constant
  • Slow smoothing setting: usually represented by a larger “slow” period or constant

In many implementations, the smoothing bounds are converted into two constants:

  • SC_fast and SC_slow derived from the fast and slow periods

The exact mapping depends on the implementation. A common approach uses exponential smoothing style constants of the form:

  • SC_fast = 2 / (fastPeriod + 1)
  • SC_slow = 2 / (slowPeriod + 1)
  1. Compute an efficiency ratio over the last N periods Over the lookback window, two quantities are compared:
  • Net change: |P[t] − P[t−N]|
  • Sum of absolute moves: sum_{i=0..N−1} |P[t−i] − P[t−i−1]|

Then an efficiency ratio ER is calculated as:

  • ER = netChange / sumAbsMoves

This ER is designed to be higher when price moves strongly from its start to its end relative to the amount of “back and forth” movement inside the window. When ER is near 0, price has been choppy; when ER is closer to 1, price has moved more directly.

A detail that implementations handle explicitly: if sumAbsMoves is zero (for example, if the price is unchanged across the whole window), ER may be set to 0 or handled to avoid division by zero. You should replicate the same rule used in your source.

  1. Convert ER into a dynamic smoothing constant A variable smoothing constant SC[t] is then computed using ER and the smoothing bounds. A common structure is:
  • SC[t] = (ER × (SC_fast − SC_slow) + SC_slow)^2

The exponent (often 2) is part of the commonly used formulation; if your implementation uses a different exponent, you must use the same one.

  1. Update Kama recursively Finally, Kama is updated as:
  • Kama[t] = Kama[t−1] + SC[t] × (P[t] − Kama[t−1])

This form makes Kama “pull toward” the current price by an amount that depends on SC[t]. Larger SC means faster adjustment; smaller SC means slower adjustment.

  1. Initialization Kama requires an initial starting value Kama[0] (or Kama[N−1], depending on indexing). Many implementations initialize Kama with the price at the first available point or with a simple moving average. If you want to independently verify the calculation, confirm the exact initialization rule from the indicator definition you are testing.

Evidence or example (with explicit assumptions)

Below is a small numeric walkthrough using stated assumptions. This is not live market data; it shows the calculation structure you can repeat with your own series.

Assumptions for the example:

  • Input price P is the close price.
  • Lookback length N = 3.
  • fastPeriod = 2, slowPeriod = 30, so:
    • SC_fast = 2/(2+1) = 0.666666…
    • SC_slow = 2/(30+1) = 0.064516…
  • Exponent is 2 in SC[t].
  • Previous Kama value is Kama[t−1] = 100.

Suppose at time t you have:

  • P[t−2] = 99
  • P[t−1] = 101
  • P[t] = 100

Step A: netChange

  • netChange = |P[t] − P[t−N]| = |100 − 99| = 1

Step B: sumAbsMoves For N = 3, we need |P[t]−P[t−1]| + |P[t−1]−P[t−2]| + |P[t−2]−P[t−3]|. But our mini-series only shows two previous prices. To keep the demonstration consistent, expand the window to include P[t−3].

Let P[t−3] = 98. Now compute:

  • |P[t] − P[t−1]| = |100 − 101| = 1
  • |P[t−1] − P[t−2]| = |101 − 99| = 2
  • |P[t−2] − P[t−3]| = |99 − 98| = 1
  • sumAbsMoves = 1 + 2 + 1 = 4

Step C: ER

  • ER = netChange / sumAbsMoves = 1 / 4 = 0.25

Step D: dynamic smoothing constant

  • SC[t] = (ER × (SC_fast − SC_slow) + SC_slow)^2 First compute (SC_fast − SC_slow):
  • 0.666666… − 0.064516… = 0.602150… Then linear term:
  • ER × (SC_fast − SC_slow) + SC_slow = 0.25 × 0.602150… + 0.064516… = 0.150537… + 0.064516… = 0.215053… Square it:
  • SC[t] ≈ (0.215053…)^2 ≈ 0.0463

Step E: update Kama

  • Kama[t] = Kama[t−1] + SC[t] × (P[t] − Kama[t−1]) = 100 + 0.0463 × (100 − 100) = 100

In this constructed example, the current price equals the previous Kama, so the update is zero. If P[t] were different from Kama[t−1], you would see a nonzero adjustment scaled by SC[t].

Why this illustrates the idea: if ER increases (price becomes more direct over N periods), SC[t] tends to move toward SC_fast, making Kama respond faster. If ER decreases (choppier movement), SC[t] tends toward SC_slow, making Kama smoother.

Limitations and risks

  1. Parameter mismatch Kama depends on N, fast/slow settings, and the exponent and handling rules for edge cases (like division by zero). If you copy the formula but not the exact parameter mapping from your indicator, you will reproduce different values.

  2. Input price definition Different platforms define the “price” differently. If one uses close and another uses a derived price (for example, average of high/low/close), the entire output series changes.

Trading foreign exchange and CFDs involves substantial risk. Information on FoxiForex is educational and is not personal financial advice. Sponsored placements are labelled clearly.