Summary
TwiggsMoneyFlow is RTTA's streaming Twiggs Money Flow. Each bar's volume is
signed by close position within true high/true low, then both the signed flow
and volume are EMA-smoothed; the indicator is their ratio.
Update API
value = rtta.TwiggsMoneyFlow(window=21, fillna=True).update(high, low, close, volume)
With fillna=False, output is NaN until window samples have been seen.
Theory Of Operation
Colin Twiggs' money flow improves on classic Chaikin Money Flow by using true high and true low (including the previous close) instead of the raw high-low range. That reduces gaps' distortion of the close's position in the range. EMA smoothing of both the accumulation/distribution volume and raw volume replaces a simple rolling sum, giving a more responsive normalized flow typically in \((-1, 1)\).
Recurrence
Let \(H_t, L_t, C_t, V_t\) be high, low, close, volume and \(n\) be window
(default \(21\)). On the first bar, true high/low equal \(H_t, L_t\); thereafter:
Both nested EMAs use fillna=True and \(\alpha = 2/(n+1)\). Outer warm count is
\(n\).
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in
class TwiggsMoneyFlow with members ad_ and vol_ (both EMA).
