Aug 11, 2025 • 14 min read

Top 10 Pine Script Patterns Every Trader Should Know

These building blocks appear in countless robust strategies. Learn them once, reuse them often.

Quick-reference list

MTF Confirmation
Use request.security() to bring HTF trend filters into LTF entries with lookahead_off and confirmed bars.
ATR-based Stops
Size stops/takes by volatility to normalize risk across regimes.
Session Windows
Trade only during liquid hours using the session input or time checks.
Breakout with Regime Filter
Combine Donchian/HH/LL with trend filters to avoid chop.
Momentum Crossovers
EMA/SMA crossovers plus an ADX or slope constraint.
Divergence Checks
Basic RSI divergences for reversals; confirm with structure.
VWAP Anchors
Anchored VWAP around sessions or events to guide pullbacks.
Liquidity Filters
Ignore signals below a volume threshold or around news windows.
Partial Profit Ladders
Scale out at 1R/2R to lock gains and reduce variance.
MTF Volatility Regimes
Adjust position size by HTF ATR or realized volatility.

Example snippets

//@version=6
// 1) MTF confirmation (HTF EMA filter)
emaHtf = request.security(syminfo.tickerid, "60", ta.ema(close, 50), barmerge.gaps_off, barmerge.lookahead_off)
ok = barstate.isconfirmed and close > emaHtf

// 2) ATR stops
atr = ta.atr(14)
stop = close - 1.5 * atr
take = close + 2.5 * atr

// 3) Session window (NY)
inSession = time(timeframe.period, "0930-1600")

Pattern combos that work well

  • Donchian breakout + ADX trending filter + ATR stop + partials at 1R/2R.
  • EMA cross with HTF EMA gate + NY session window + VWAP proximity filter.
  • Mean-reversion RSI + Bollinger bands + no-trade during news (time windows).

Anti-patterns to avoid

  • Unconfirmed HTF signals in LTF execution (repaint risk).
  • Over-plotting too many diagnostics on heavy symbols/timeframes.
  • Optimizing to a razor-thin parameter spike with no OOS validation.

Further reading

Continue with our deep dives on MTF design andbacktest optimization.

Tools to speed up pattern assembly

PineScripter.app can assemble these patterns into complete v6 strategies with proper structure, plots, and exits. For quick prototyping, checkPineify orPine Script Wizard.