Skip to content
Open RaamTrade

VolumeOscillator — Volume Oscillator

A fast volume average against a slow one, as a percentage of the slow. Positive readings mean activity is picking up — the usual confirmation filter behind breakouts.

Signature

VolumeOscillator(fast, slow, on=<source>)
Argument Type Required Notes
fast int Param or literal Yes Fast volume SMA. Default 14, bounds 1–100.
slow int Param or literal Yes Slow volume SMA. Default 28, bounds 1–400.
on= symbol No Source symbol. Defaults to the trade symbol. Reads volume.

Formula

$$ \text{VO} = 100,\frac{\text{SMA}(V, fast) - \text{SMA}(V, slow)}{\text{SMA}(V, slow)} $$

Warmup

slow bars; 0 until both windows are full, and 0 when the slow average is zero.

Reading the value

vo.value
vo > 0

Example

class VolumeConfirmedBreakout(Strategy):
"""Channel breakout only on expanding volume."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
vo = VolumeOscillator(14, 28, on=self.trade)
dh = DonchianHighTrue(20, on=self.trade)
if self.trade.close >= dh.value_at(1) and vo.value > 5 and self.trade.is_flat:
self.buy(self.trade, reason=f"Breakout, VO {vo.value:.0f}")
if self.trade.close < dh.value * 0.97 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Failed break")

Notes

  • The standard percentage form of the volume oscillator. The 14 and 28 bar defaults are a common textbook pair. A chart saved with other values keeps them, and so does a strategy that passes both periods.