Skip to content
All library documents

KAMA Trend States with Sigma-Based Adaptive Position Scaling

Article TradingView scripts

Summary

This Pine strategy builds an adaptive moving average using Kaufman’s Efficiency Ratio (ER): the average responds more quickly when price movement is efficient and more slowly when it is choppy. It estimates deviation around the KAMA to form bands, classifies market conditions into rising, falling, or neutral states, and uses price relative to KAMA, slope, and acceleration to define those states. Entry deviation can be limited by a configurable band-based gate.

The script offers Hold, Exit, and Adaptive trade behaviors. In Adaptive mode, position size is intended to change as price extends from KAMA, with settings for trim increments, a minimum holding fraction, reload distance, cooldown, and a threshold shift in stronger trends. ER, band position, volatility conditions, and candle wicks also feed its state and dashboard. The supplied excerpt is incomplete: the core order-management section is cut off, so exact entry, exit, trim, and reload rules cannot be fully assessed. It provides no performance results, and its configurable indicator rules require instrument-specific testing.

Key ideas

  • KAMA adjusts its smoothing according to an Efficiency Ratio derived from net price movement and total path length.
  • Market state combines KAMA slope and acceleration with whether price is above or below the average.
  • Deviation bands around KAMA support an optional entry filter and adaptive position adjustments.
  • Adaptive settings specify trim steps, a position floor, reload distance, and a cooldown between adjustments.
  • The provided script omits part of its order logic and reports no evidence of strategy performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.