Summary
DeMarker is RTTA's streaming DeMarker oscillator. It compares rolling upward
high extensions to downward low extensions and maps them into a \(0\)–\(1\)
ratio.
Update API
value = rtta.DeMarker(window=14, fillna=True).update(high, low)
The first bar contributes zero DeMax/DeMin (no previous high/low). With
fillna=False, output is NaN until the window buffer is full.
Theory Of Operation
Tom DeMark's DeMarker measures demand pressure via positive high-to-high changes and supply pressure via negative low-to-low changes. Averaging each over a window and taking the ratio yields an oscillator bounded in \([0, 1]\). Readings near \(1\) indicate persistent upward high extensions; near \(0\) indicates persistent downward low extensions. Extreme zones (classically near \(0.7\) / \(0.3\)) are used as overbought/oversold references.
Recurrence
Let \(H_t, L_t\) be high and low and \(n\) be window (default \(14\)).
(with \(DeMax_0 = DeMin_0 = 0\)). Maintain rolling sums over the last \(\min(t+1, n)\) samples:
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in class DeMarker
using two rolling sum buffers (demax_, demin_).
