Volume Trade Detector identifies high-probability breakout and breakdown candles by combining volume spikes with price-action confirmation. The study highlights moments when strong momentum enters the market, often signaling institutional participation or algorithmic activity.
Core Logic
- Detects tee levels of volume spikes using customizable tesholds
- Confirms signals only when candles show:
- Bullish close + large range → BUY
- Bearish close + large range → SELL
- Range expansion is defined as > 1.5× the 20-period average candle size
- Green vertical line for BUY signals
- Red vertical line for SELL signals
- Optional chart bubbles showing timestamp and volume
- Dashboard labels display cuent volume, average volume, signal strength, and live status
- Optional real-time alerts when signals trigger
- 5m–15m: intraday breakout detection, trend continuation
- 30m–1H: swing confirmation, major momentum shifts
Volume Trade Detector filters noise by requiring both unusual volume and strong price expansion. This combination isolates meaningful momentum events that often mark the start of powerful directional moves.
The script uses tee customizable volume thresholds:
- Level 1 Spike — Moderate activity
- Level 2 Spike — Strong activity
- Level 3 Spike — Very strong / institutional-level activity
Higher volume equals stronger “signal strength,” displayed as 1, 2, or 3.
A volume spike alone is not enough.
To reduce noise, the candle must also show:
✔ Candle Direction
- Green (close > open) → potential BUY setup
- Red (close < open) → potential SELL setup
The candle must be significantly larger than normal:
-
1.5× the 20-period average range
A valid signal occurs only when:
BUY Signal
- Volume spike (any level)
- Large range candle
- Candle closes bullish
- Volume spike
- Large range candle
- Candle closes bearish
Vertical Lines
- Green line = Buy signal
- Red line = Sell signal
Chart Bubbles
Each signal prints a bubble showing:
- Timestamp (optional)
- Volume of the candle (optional)
"Commented out"
Dashboard Labels
Always visible on the chart:
- Current Volume
- 20-Period Average Volume
- Signal Strength (1–3)
- Current
- Status: BUY / SELL / NONE
Alerts
The script includes optional alerts:
- Popup + sound when a buy signal prints
- Popup + sound when a sell signal prints
Code:
# Volume Trade Detector By CANDO13579
declare upper;
# Input parameters
input volumeThreshold1 = 1000;
input volumeThreshold2 = 2000;
input volumeThreshold3 = 3000;
input timeWindow = 5;
input showTime = yes;
input showVolume = yes;
input useBuyAlerts = yes;
input useSellAlerts = yes;
input showBuySignals = yes;
input showSellSignals = yes;
input showVerticalLines = yes;
# Calculate average volume for comparison
def avgVolume = Average(volume, 20);
# Detect volume spikes
def isVolumeSpike1 = volume >= volumeThreshold1 and volume < volumeThreshold2;
def isVolumeSpike2 = volume >= volumeThreshold2 and volume < volumeThreshold3;
def isVolumeSpike3 = volume >= volumeThreshold3;
# Determine signal strength (higher volume = stronger signal)
def signalStrength = if isVolumeSpike3 then 3 else if isVolumeSpike2 then 2 else if isVolumeSpike1 then 1 else 0;
# Price action conditions for buy/sell signals
def isUpBar = close > open;
def isDownBar = close < open;
def avgRange = Average(high - low, 20);
def isLargeRange = (high - low) > avgRange * 1.5;
# Generate buy/sell signals on volume spikes with price confirmation
def buySignal = (isVolumeSpike1 or isVolumeSpike2 or isVolumeSpike3) and isUpBar and isLargeRange;
def sellSignal = (isVolumeSpike1 or isVolumeSpike2 or isVolumeSpike3) and isDownBar and isLargeRange;
# Plot buy signals as arrows
#plot BuyArrow = if showBuySignals then buySignal else Double.NaN;
#BuyArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
#BuyArrow.SetDefaultColor(Color.GREEN);
#BuyArrow.SetLineWeight(2);
# Plot sell signals as arrows
#plot SellArrow = if showSellSignals then sellSignal else Double.NaN;
#SellArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#SellArrow.SetDefaultColor(Color.RED);
#SellArrow.SetLineWeight(2);
# Add vertical lines for signals
AddVerticalLine(showVerticalLines and buySignal, "Buy", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(showVerticalLines and sellSignal, "Sell", Color.RED, Curve.SHORT_DASH);
# Alerts
Alert(useBuyAlerts and buySignal, "Trade Detector Buy Signal - Volume: " + AsText(volume), Alert.BAR, Sound.Chimes);
Alert(useSellAlerts and sellSignal, "Trade Detector Sell Signal - Volume: " + AsText(volume), Alert.BAR, Sound.Bell);
# Add bubbles for labels
AddChartBubble(buySignal or sellSignal,
if buySignal then low else high,
(if showTime then GetYYYYMMDD() + " " + AsText(GetTime()) + "\n" else "") +
(if showVolume then "Vol: " + AsText(volume) else ""),
if buySignal then Color.GREEN else Color.RED,
if buySignal then no else yes);
# Current status labels
AddLabel(yes, "Current Volume: " + AsText(volume), Color.WHITE);
AddLabel(yes, "Avg Volume: " + AsText(Round(avgVolume, 0)), Color.WHITE);
AddLabel(yes, "Signal Strength: " + AsText(signalStrength),
if signalStrength == 3 then Color.RED else if signalStrength == 2 then Color.ORANGE else if signalStrength == 1 then Color.YELLOW else Color.GRAY);
AddLabel(yes, "Status: " + (if buySignal then "BUY" else if sellSignal then "SELL" else "NONE"),
if buySignal then Color.GREEN else if sellSignal then Color.RED else Color.GRAY);
Last edited by a moderator: