What it does
KAMA Trend Filter draws Perry Kaufman's adaptive moving average and colours it in three states: green for an efficient uptrend, red for an efficient downtrend and grey when price is moving without much direction. Arrows mark the closed bar on which a new green or red state begins.
The aim is a single line that speeds up when the market trends cleanly and slows almost to a halt when the market chops, so it doubles as a trend filter for other signals.
How it works
- Efficiency ratio (ER) = |close − close n bars ago| ÷ sum of |close − previous close| over the same n bars. It is 1 when every bar moved the same way and close to 0 in noisy, back-and-forth trading.
- Smoothing constant = (ER × (fast SC − slow SC) + slow SC)², where fast SC = 2 ÷ (2 + 1) and slow SC = 2 ÷ (30 + 1) with the default inputs.
- KAMA = previous KAMA + smoothing constant × (close − previous KAMA).
- Trend state: if ER is at or above the threshold (0.30) and KAMA is higher than it was 3 bars ago, the state is up. If ER passes the threshold and KAMA is lower, the state is down. Otherwise the state is range.
An arrow is drawn when a closed bar's state changes to up or down from anything else.
How to use it
- Use the colour as a permission filter. Look for long setups from another method only while the line is green, and short setups only while it is red.
- Grey periods are a warning that the market is not trending efficiently. Many traders reduce size or stand aside then, or switch to range tactics around support and resistance.
- Because KAMA flattens in noise, price crossing a flat grey line means little. A crossing that comes with a colour change is more informative.
- Raising the ER threshold gives fewer, more selective trend states. Lowering it colours more of the chart.
- It is well suited to H1 to D1 on currency pairs, gold and indices.
Settings
| Input | Default | What it changes |
|---|---|---|
| Efficiency ratio length | 10 | Window for measuring trend efficiency; longer is steadier |
| Fast smoothing length | 2 | How quickly KAMA follows price in strong trends |
| Slow smoothing length | 30 | How slowly KAMA moves in noise |
| Minimum efficiency ratio | 0.30 | Threshold between trend and range colouring |
| Bars used to measure slope | 3 | Sensitivity of the up/down decision |
| Pop-up alert / Push notification | false / false | One alert per closed bar on a new trend state |
Limitations
- The efficiency ratio is calculated on closing prices only, so large wicks are ignored.
- State changes can flicker around the threshold when ER hovers near 0.30.
- KAMA still lags at turning points, especially after a long efficient trend when it has caught up closely with price.
- The live bar's colour can change until the bar closes; arrows and alerts are confirmed on the close and stay fixed.
- This is an educational filter, not a complete strategy. Trading involves substantial risk of loss.

