Volume
Spikes, trend shifts, dry-ups, and breakout confirmation using volume.
Each recipe below is a complete core-logic body: drop it under your market/timeframe pragmas and adjust the thresholds to taste. Every query on this page has been parsed and evaluated against the current XQL grammar.
volume units differ by market
volume means different things on different markets: base-asset traded volume for crypto, a price-update tick count for forex/indices/commodities/metals. See OHLCV Series before reusing a fixed volume threshold across markets; every recipe below compares an instrument's volume against its own recent history instead of a hardcoded constant, which sidesteps the issue.
Volume Spike by Multiplier
"Volume more than 2x its 20-period average": bind the average to a let so the multiplication reads cleanly:
let avgv = avg(volume, 20)
volume > avgv * 2Volume Trend Crossover
A single spike can be noise; a sustained shift in participation is a stronger signal. Crossing the short EMA of volume above the long EMA of volume catches interest building over several bars, not just one:
crossover(ema(volume, 10), ema(volume, 30))Breakout Confirmed by Volume
Combines the new N-day high recipe with a volume gate: a breakout on light volume is far more likely to fail than one backed by real participation:
close > highest(high, 20) and volume > avg(volume, 20) * 1.5Volume Dry-Up Before a Move
The inverse of a spike: unusually low volume, often the calm-before-the-storm setup that precedes a breakout once participation returns:
volume < avg(volume, 20) * 0.5Statistical Volume Spike
A flat multiplier (as in the first recipe) treats every instrument's volume the same way regardless of how noisy its volume history normally is. Using stdev instead adapts the threshold per instrument: a proper two-standard-deviation spike:
let avgv = avg(volume, 20)
let sdv = stdev(volume, 20)
volume > avgv + 2 * sdvNew N-Period Volume High
The same "new high" shape as the breakout recipe, but sourced from volume instead of high: a volume climax, often associated with capitulation or exhaustion:
volume > highest(volume, 50)highest defaults to high
highest(volume, 50) requires the explicit volume source argument: highest(50) alone would default to high, not volume. See Functions.