KlingerOscillator — Klinger Oscillator
תוכן זה אינו זמין עדיין בשפה שלך.
Volume signed by the direction of the typical price, smoothed fast and slow. Klinger’s aim was a long-term money-flow read that still turns quickly enough to trade — the fast/slow difference is what gives it both.
Signature
KlingerOscillator(fast, slow, signal_period, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
fast |
int Param or literal | Yes | Fast EMA of signed volume. Default 34, bounds 1–200. |
slow |
int Param or literal | Yes | Slow EMA of signed volume. Default 55, bounds 2–400. |
signal_period |
int Param or literal | Yes | EMA of the oscillator. Default 13, bounds 1–200. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high, low, close, volume. |
Formula
$$ sv_t = V_t \cdot \text{sign}(TP_t - TP_{t-1}), \quad \text{KVO} = \text{EMA}(sv, f) - \text{EMA}(sv, s) $$
The trend sign persists when the typical price is unchanged.
Warmup
Roughly 3 × slow bars for the EMAs to converge.
Reading the value
kvo.kvokvo.signalkvo.kvo > kvo.signalMulti-value: cannot be chained onto or crossed.
Example
class KlingerCross(Strategy): """Trade the KVO/signal crossover in the direction of the trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): kvo = KlingerOscillator(34, 55, 13, on=self.trade) sma = SMA(50, on=self.trade) if kvo.kvo > kvo.signal and self.trade.close > sma.value and self.trade.is_flat: self.buy(self.trade, reason="Klinger cross up") if kvo.kvo < kvo.signal and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Klinger cross down")Notes
- Stephen Klinger’s Volume Oscillator. Simplified: Klinger’s full volume force multiplies by a trend-dependent range term; this ships the widely-used signed-volume form, which tracks the same shape with less state. Stated because it is a deviation from the original paper.