Examples
This section documents examples of common expressions.
Golden Cross Breakout
Classic bullish signal when short-term moving average crosses above long-term moving average with volume confirmation.
// Golden cross with volume confirmation
ta.crossover(ta.sma($BTC, 50), ta.sma($BTC, 200)) and $BTC.volume > ta.sma($BTC.volume, 20) * 1.5
// EMA golden cross for faster signals
ta.crossover(ta.ema($BTC, 21), ta.ema($BTC, 50)) and ta.rsi($BTC, 14) > 50RSI Oversold Bounce
Looking for oversold conditions with signs of reversal momentum.
// RSI oversold with bullish divergence setup
ta.rsi($BTC, 14) < 30 and ta.rsi($BTC, 14) > ta.rsi($BTC, 14)[1] and $BTC.close > $BTC.close[1]
// Double confirmation oversold
ta.rsi($BTC, 14) < 30 and ta.stoch($BTC, 14, 3).k < 20 and ta.crossover(ta.stoch($BTC, 14, 3).k, ta.stoch($BTC, 14, 3).d)VWAP Support Test
Price testing VWAP as support level with successful bounce.
// VWAP support bounce
$BTC.low < ta.vwap($BTC) and $BTC.close > ta.vwap($BTC) and $BTC.close > $BTC.open
// VWAP support with volume
$BTC.low < ta.vwap($BTC) and $BTC.close > ta.vwap($BTC) and $BTC.volume > ta.sma($BTC.volume, 10)Bollinger Band Squeeze Breakout
Low volatility followed by expansion and directional breakout.
// Squeeze followed by upper band breakout
ta.bb($BTC, 20, 2).upper - ta.bb($BTC, 20, 2).lower < ta.sma(ta.atr($BTC, 14), 10) * 2 and
ta.crossover($BTC.close, ta.bb($BTC, 20, 2).upper) and $BTC.volume > ta.sma($BTC.volume, 20) * 1.2
// Squeeze with momentum confirmation
ta.bb($BTC, 20, 2).upper - ta.bb($BTC, 20, 2).lower < ta.bb($BTC, 20, 2)[5].upper - ta.bb($BTC, 20, 2)[5].lower and
ta.macd($BTC, 12, 26, 9).histogram > 0MACD Signal Line Cross
MACD line crossing above signal line indicating momentum shift.
// MACD bullish crossover above zero
ta.crossover(ta.macd($BTC, 12, 26, 9).macd, ta.macd($BTC, 12, 26, 9).signal) and ta.macd($BTC, 12, 26, 9).macd > 0
// MACD with histogram growing
ta.macd($BTC, 12, 26, 9).macd > ta.macd($BTC, 12, 26, 9).signal and
ta.macd($BTC, 12, 26, 9).histogram > ta.macd($BTC, 12, 26, 9)[1].histogramBreakout Above Resistance
Price breaking above previous high with volume confirmation.
// 20-period high breakout with volume
ta.crossover($BTC.close, ta.highest($BTC.high, 20)) and $BTC.volume > ta.highest($BTC.volume, 10)
// Resistance breakout with momentum
$BTC.close > ta.highest($BTC.high, 20) and ta.rsi($BTC, 14) > 60 and ta.adx($BTC, 14) > 25Mean Reversion to Moving Average
Price returning to moving average after deviation.
// Price returning to 20 SMA from below
$BTC.close[1] < ta.sma($BTC, 20) and ta.crossover($BTC.close, ta.sma($BTC, 20)) and ta.rsi($BTC, 14) > 40
// Oversold mean reversion
$BTC.close < ta.sma($BTC, 20) * 0.95 and ta.rsi($BTC, 14) < 40 and $BTC.close > $BTC.lowStochastic Overbought Reversal
Stochastic in overbought territory showing signs of reversal.
// Stochastic overbought with bearish cross
ta.stoch($BTC, 14, 3).k > 80 and ta.crossunder(ta.stoch($BTC, 14, 3).k, ta.stoch($BTC, 14, 3).d)
// Double overbought confirmation
ta.stoch($BTC, 14, 3).k > 80 and ta.rsi($BTC, 14) > 70 and $BTC.close < $BTC.openVolume Breakout Pattern
Unusual volume spike indicating institutional interest.
// Volume spike with price breakout
$BTC.volume > ta.sma($BTC.volume, 20) * 2 and $BTC.close > ta.highest($BTC.close, 10)
// Volume and price momentum alignment
$BTC.volume > ta.highest($BTC.volume, 20) and ta.obv($BTC) > ta.obv($BTC)[5] and $BTC.close > ta.sma($BTC, 10)Parabolic SAR Trend Change
Parabolic SAR flipping indicating potential trend reversal.
// PSAR bullish flip with momentum
ta.psar($BTC, 0.02, 0.2) < $BTC.close and ta.psar($BTC, 0.02, 0.2)[1] > $BTC.close[1] and ta.rsi($BTC, 14) > 50
// PSAR with moving average confirmation
$BTC.close > ta.psar($BTC, 0.02, 0.2) and $BTC.close > ta.ema($BTC, 20)ADX Trend Strength Filter
Using ADX to confirm strong trending conditions before entry.
// Strong trend with momentum
ta.adx($BTC, 14) > 25 and ta.sma($BTC, 10) > ta.sma($BTC, 20) and ta.macd($BTC, 12, 26, 9).macd > 0
// Trend strength increasing
ta.adx($BTC, 14) > 20 and ta.adx($BTC, 14) > ta.adx($BTC, 14)[3] and $BTC.close > ta.sma($BTC, 50)Williams %R Reversal Setup
Williams %R showing reversal from extreme levels.
// Williams %R oversold reversal
ta.williamsr($BTC, 14) < -80 and ta.williamsr($BTC, 14) > ta.williamsr($BTC, 14)[1] and $BTC.close > $BTC.open
// Williams %R with volume confirmation
ta.williamsr($BTC, 14) > -20 and ta.williamsr($BTC, 14)[1] > -20 and $BTC.volume > ta.sma($BTC.volume, 10) and $BTC.close < $BTC.openMulti-Timeframe Alignment
Short and long-term indicators aligned for high-probability setup.
// Triple moving average alignment
ta.sma($BTC, 10) > ta.sma($BTC, 20) and ta.sma($BTC, 20) > ta.sma($BTC, 50) and ta.rsi($BTC, 14) > 55
// Momentum and trend alignment
ta.macd($BTC, 12, 26, 9).macd > ta.macd($BTC, 12, 26, 9).signal and
ta.ema($BTC, 12) > ta.ema($BTC, 26) and ta.adx($BTC, 14) > 20Volatility Expansion Setup
Low volatility followed by expansion indicating potential big move.
// ATR expansion after compression
ta.atr($BTC, 14) < ta.sma(ta.atr($BTC, 14), 20) * 0.8 and
ta.atr($BTC, 14) > ta.atr($BTC, 14)[1] and $BTC.volume > ta.sma($BTC.volume, 20)
// Bollinger Band expansion
ta.bb($BTC, 20, 2).upper - ta.bb($BTC, 20, 2).lower > ta.sma(ta.bb($BTC, 20, 2).upper - ta.bb($BTC, 20, 2).lower, 10) * 1.2Money Flow Divergence
Price and money flow showing divergence indicating potential reversal.
// Bearish MFI divergence
$BTC.close > ta.highest($BTC.close, 10) and ta.mfi($BTC, 14) < ta.highest(ta.mfi($BTC, 14), 10) and ta.mfi($BTC, 14) > 80
// Bullish volume divergence
$BTC.close < ta.lowest($BTC.close, 10) and ta.obv($BTC) > ta.lowest(ta.obv($BTC), 10) and ta.rsi($BTC, 14) < 40Last updated
Was this helpful?