Skip to content
Open RaamTrade

SignedVolume: Signed Volume

Volume signed by the bar’s direction: positive on an up close, negative on a down close, summed over the window. With period = 1 it is the raw per-bar signed volume; with a longer window it is the net flow over that window, which is OBV’s information without the unbounded accumulation.

Signature

SignedVolume(period, on=<source>)
Argument Type Required Notes
period int Param or literal Yes Summation window. Default 1 (per-bar). Bounds 1–400.
on= symbol No Source symbol. Defaults to the trade symbol. Reads close and volume.

Formula

$$ \text{SignedVolume} = \sum_{i=t-n+1}^{t} \text{sign}(C_i - C_{i-1}),V_i $$

An unchanged close contributes zero.

Warmup

period + 1 bars.

Reading the value

sv.value
sv > 0

Example

class NetFlow(Strategy):
"""Enter when signed volume over 20 bars is decisively positive."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sv = SignedVolume(20, on=self.trade)
avg = RelativeVolume(20, on=self.trade)
if sv.value > 0 and avg.value > 1 and self.trade.is_flat:
self.buy(self.trade, reason="Net buying with participation")
if sv.value < 0 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Net selling")

Notes

  • The sign rule is Joseph Granville’s, from On-Balance Volume (Granville’s New Key to Stock Market Profits, 1963).
  • The windowed, non-accumulating relative of OBV: bounded by the window, so the level is actually comparable across time.