דלגו לתוכן
פתיחת RaamTrade

EfficiencyRatio — Efficiency Ratio

תוכן זה אינו זמין עדיין בשפה שלך.

Net move divided by total path travelled: 1 when price went straight there, near 0 when it covered the same ground repeatedly. Kaufman’s noise measure, and the engine inside KAMA.

Signature

EfficiencyRatio(period, on=<source>)
Argument Type Required Notes
period int Param or literal Yes Window. Default 10, bounds 1–400.
on= symbol, OHLCV field, or indicator No Source. Defaults to the trade symbol’s close.

Formula

$$ ER = \frac{|C_t - C_{t-n}|}{\sum_{i} |C_i - C_{i-1}|} $$

Warmup

period + 1 bars; 0 until then, and 0 on a completely flat window.

Reading the value

er.value
er > 0.4

Example

class EfficiencyGate(Strategy):
"""Trend rules only when price is actually going somewhere."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
er = EfficiencyRatio(10, on=self.trade)
sma = SMA(50, on=self.trade)
if er.value > 0.4 and self.trade.close > sma.value and self.trade.is_flat:
self.buy(self.trade, reason=f"ER {er.value:.2f}")
if er.value < 0.2 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Market gone noisy")

Notes

  • Perry Kaufman, Smarter Trading (1995).
  • Proven by an assert-via-trade run on SPY daily (matched a strategy-side path computation to 1e-4 on every bar; zero alarm trades).
  • Bounded 0–1 by construction, which makes it directly comparable across instruments — one of the few regime measures that is.