Summary
EfficiencyRatio is RTTA's streaming implementation of: Kaufman efficiency ratio of net directional move to path length over a rolling window.
Update API
result = rtta.EfficiencyRatio().update(close)
The update(...) call consumes one observation using close. advance(...)
uses the same inputs when the caller wants to update state without materializing
a Python return value.
Theory Of Operation
EfficiencyRatio is the direction/noise ratio that drives
Kama. Values near 1 mean a clean directional move; values near 0
mean a noisy path with little net displacement.
Recurrence
Let \(c_t = close_t\) and \(n\) the window.
The denominator is a rolling sum of absolute one-step changes. The numerator uses the close from \(n\) samples earlier, matching the efficiency term inside KAMA.
Exactly \(n\) price changes require \(n+1\) closes. With fillna=False, the
first \(n\) updates therefore return NaN, and the first complete ratio is
returned on update \(n+1\). With fillna=True, startup uses all changes seen so
far; the first close returns 0. The ratio is bounded to \([0,1]\) by the triangle
inequality (with safe division for a flat path).
The return value is the current scalar indicator value.
Composed Primitives
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in class EfficiencyRatio.
