Summary
VolumeRunBarGenerator is a volume-weighted run bar: while the tick-rule sign stays
the same, trade volume accumulates; the bar closes when run volume reaches a threshold
(not tick count).
Update API
import rtta
ind = rtta.VolumeRunBarGenerator(threshold=10000.0)
result = ind.update(close, volume)
# result.bar_open, bar_close, bar_high, bar_low, bar_volume,
# result.direction, result.complete, result.bars
Flat ticks leave the run unchanged. An opposite sign starts a new run with volume equal to the current print and OHLC reset to that close.
Theory Of Operation
Standard run bars count ticks; volume run bars weight each same-sign tick by its size so that a few large prints can complete a bar as fast as many small ones. This is the run analogue of volume bars within a persistent-sign regime.
Recurrence
Let \(V^\star > 0\) be threshold and
If \(s_t \neq 0\):
where \(v_t^+ = \max(v_t,0)\). High/low track \(c_t\) while the run is active.
When \(V_{\mathrm{run}} \ge V^\star\):
Otherwise \(\mathrm{bar\_volume}=V_{\mathrm{run}}\), complete/bars/direction zero
(except incomplete runs still report direction only on completion).
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in
class VolumeRunBarGenerator. Result type is InformationBarResult.
