Volume filter (relative average)
Allow a signal only if current volume ≥ X times the rolling average. Filters out signals in phases of poor liquidity.
Core idea
A volume filter only lets entry signals through when the current candle volume is significantly above average. The assumption: strong volume confirms the price move — weak volume points to false breakouts.
Formula
volume_ratio = current_volume / rolling_avg_volume(lookback)
pass the signal if: volume_ratio >= min_volume_ratio
Botty implementation
strategies/conditions.py → filter condition volume_filter.
def _filter_volume(df, latest, signal, **p):
min_ratio = p.get("min_volume_ratio", 0)
lookback = p.get("volume_lookback", 20)
avg_vol = df["volume"].iloc[-lookback-1:-1].mean()
current = latest.get("volume", 0)
return (current / avg_vol) >= min_ratio
Parameters:
- min_volume_ratio (default: 1.0) — minimum ratio
- volume_lookback (default: 20) — bars for the average
Typical thresholds
| Ratio | Interpretation |
|---|---|
| < 0.5 | Very weak volume — caution |
| 1.0 | Average |
| 1.5 | 50% above average — good breakout signal |
| 2.0+ | Strongly above-average volume |
When is it useful?
- For breakout patterns (outside-inside, SFP) where volume confirmation matters
- In quiet Asia sessions where false breakouts are common
- In combination with
session_filter
Caveat for crypto/perps
On Hyperliquid, the OHLCV volume contains the trading volume in the base currency (BTC). The relative threshold (ratio) matters more than the absolute value, since the latter fluctuates strongly across market phases.