OPEN-SOURCE SCRIPT
BBG Trap Score Indicator

=================================================================
Trap Score - Institutional Liquidity & Trapped Trader Index [v6]
=================================================================
DESCRIPTION:
The Trap Score Index is a quantitative, non-repainting trading indicator designed to detect inducement, liquidity sweeps, trapped buyers, trapped sellers, absorption, and failed breakouts near key higher-timeframe (HTF) level locations.
Rather than relying on subjective pattern recognition, this tool translates order flow dynamics and price action into a deterministic 0 to 100 Trap Score computed at the close of every candle.
CORE CONCEPT:
Markets frequently generate fake breakouts beyond key swing highs and lows to trigger retail stop orders and attract aggressive breakout traders into illiquid positions. When institutional participants absorb these breakout orders, price fails to advance and reclaims the broken level, leaving retail traders trapped.
This indicator calculates two independent normalized metrics:
• 🟥 Bearish Trap Score: Measures trapped buyers at key resistance ➔ Short Setup
• 🟩 Bullish Trap Score: Measures trapped sellers at key support ➔ Long Setup
11 QUANTITATIVE SCORING FACTORS (100 Points Max):
Each candle evaluates 11 weighted mathematical conditions to build the 0–100 score:
1. Liquidity Sweep at Level (15 pts): Candle wicks past an N-bar swing level and closes back inside with wick ratio ≥ 35% and sweep distance ≤ 0.50 ATR.
2. Failed Breakout / Reclaim (15 pts): Price traded outside a key level and failed to hold outside within 3 bars.
3. Extreme Delta (10 pts): Intrabar volume delta ≥ 2.0× its 20-period average.
4. Volume Expansion (10 pts): Candle volume ≥ 1.5× its 20-period SMA.
5. Absorption (15 pts): Extreme volume/delta expansion accompanied by minimal price progress (≤ 0.15 ATR).
6. Delta-Price Divergence (10 pts): Volume delta achieves a new 5-bar extreme while price close fails to confirm.
7. Large-Trade Absorption (10 pts): Extreme volume spike (≥ 2.5× average) with a large wick (≥ 40%) and price progress ≤ 0.15 ATR.
8. HTF Location Proximity (10 pts): Current price within 0.15 × HTF ATR of HTF Swings, Previous Day High/Low (PDH/PDL), Previous Week High/Low (PWH/PWL), or Session VWAP.
9. VWAP / Value Area Rejection (5 pts): Rejection wick crossing Session VWAP or ± 1 stddev bands.
10. Confirmation Candle (5 pts): Candle close confirming directional momentum past the sweep range.
11. Exhaustion (5 pts): 3 consecutive bars of declining volume with narrow candle range (< 0.50 ATR).
HOW TO TRADE WITH TRAP SCORE:
1. Conviction Tiers & Signal Thresholds:
• Score < 50: Neutral / No Trade
• Score 50 – 64: Low Conviction (Observe)
• Score 65 – 79: Standard Setup (Default Alert Trigger)
• Score 80 – 89: High Conviction Setup
• Score ≥ 90: Exceptional Setup
2. Entry Rules:
• Enter on the open of the bar following a confirmed signal candle where Trap Score ≥ 65.
• Ensure market has not established acceptance outside the swept reference level.
3. Stop Loss Placement:
• Long Position: Sweep Low - (ATR × 0.10)
• Short Position: Sweep High + (ATR × 0.10)
4. Profit Targets (Partial Scale-Out):
• TP1 (50%): At 1.0R or Session VWAP (Move stop loss to Breakeven).
• TP2 (25%): At range midpoint or opposing value area.
• TP3 (25%): At opposing liquidity pool (PWH for longs, PWL for shorts) or 3.0R.
KEY SETTINGS & CUSTOMIZATION:
• HTF Resolution: Higher timeframe context resolution (Default: 240 / 4H).
• Swing Lookback: Number of bars to confirm reference highs and lows (Default: 20).
• Minimum Entry Score: Configurable signal score threshold (Default: 65).
• Dashboard Table: Toggleable top-right status summary panel displaying live scores, conviction levels, sweep states, and signals.
NON-REPAINTING GUARANTEE:
This indicator uses strict non-repainting Pine Script v6 syntax. Higher timeframe security requests fetch only closed completed bars (lookahead = barmerge.lookahead_off) to prevent lookahead bias or hindsight repainting.
Trap Score - Institutional Liquidity & Trapped Trader Index [v6]
=================================================================
DESCRIPTION:
The Trap Score Index is a quantitative, non-repainting trading indicator designed to detect inducement, liquidity sweeps, trapped buyers, trapped sellers, absorption, and failed breakouts near key higher-timeframe (HTF) level locations.
Rather than relying on subjective pattern recognition, this tool translates order flow dynamics and price action into a deterministic 0 to 100 Trap Score computed at the close of every candle.
CORE CONCEPT:
Markets frequently generate fake breakouts beyond key swing highs and lows to trigger retail stop orders and attract aggressive breakout traders into illiquid positions. When institutional participants absorb these breakout orders, price fails to advance and reclaims the broken level, leaving retail traders trapped.
This indicator calculates two independent normalized metrics:
• 🟥 Bearish Trap Score: Measures trapped buyers at key resistance ➔ Short Setup
• 🟩 Bullish Trap Score: Measures trapped sellers at key support ➔ Long Setup
11 QUANTITATIVE SCORING FACTORS (100 Points Max):
Each candle evaluates 11 weighted mathematical conditions to build the 0–100 score:
1. Liquidity Sweep at Level (15 pts): Candle wicks past an N-bar swing level and closes back inside with wick ratio ≥ 35% and sweep distance ≤ 0.50 ATR.
2. Failed Breakout / Reclaim (15 pts): Price traded outside a key level and failed to hold outside within 3 bars.
3. Extreme Delta (10 pts): Intrabar volume delta ≥ 2.0× its 20-period average.
4. Volume Expansion (10 pts): Candle volume ≥ 1.5× its 20-period SMA.
5. Absorption (15 pts): Extreme volume/delta expansion accompanied by minimal price progress (≤ 0.15 ATR).
6. Delta-Price Divergence (10 pts): Volume delta achieves a new 5-bar extreme while price close fails to confirm.
7. Large-Trade Absorption (10 pts): Extreme volume spike (≥ 2.5× average) with a large wick (≥ 40%) and price progress ≤ 0.15 ATR.
8. HTF Location Proximity (10 pts): Current price within 0.15 × HTF ATR of HTF Swings, Previous Day High/Low (PDH/PDL), Previous Week High/Low (PWH/PWL), or Session VWAP.
9. VWAP / Value Area Rejection (5 pts): Rejection wick crossing Session VWAP or ± 1 stddev bands.
10. Confirmation Candle (5 pts): Candle close confirming directional momentum past the sweep range.
11. Exhaustion (5 pts): 3 consecutive bars of declining volume with narrow candle range (< 0.50 ATR).
HOW TO TRADE WITH TRAP SCORE:
1. Conviction Tiers & Signal Thresholds:
• Score < 50: Neutral / No Trade
• Score 50 – 64: Low Conviction (Observe)
• Score 65 – 79: Standard Setup (Default Alert Trigger)
• Score 80 – 89: High Conviction Setup
• Score ≥ 90: Exceptional Setup
2. Entry Rules:
• Enter on the open of the bar following a confirmed signal candle where Trap Score ≥ 65.
• Ensure market has not established acceptance outside the swept reference level.
3. Stop Loss Placement:
• Long Position: Sweep Low - (ATR × 0.10)
• Short Position: Sweep High + (ATR × 0.10)
4. Profit Targets (Partial Scale-Out):
• TP1 (50%): At 1.0R or Session VWAP (Move stop loss to Breakeven).
• TP2 (25%): At range midpoint or opposing value area.
• TP3 (25%): At opposing liquidity pool (PWH for longs, PWL for shorts) or 3.0R.
KEY SETTINGS & CUSTOMIZATION:
• HTF Resolution: Higher timeframe context resolution (Default: 240 / 4H).
• Swing Lookback: Number of bars to confirm reference highs and lows (Default: 20).
• Minimum Entry Score: Configurable signal score threshold (Default: 65).
• Dashboard Table: Toggleable top-right status summary panel displaying live scores, conviction levels, sweep states, and signals.
NON-REPAINTING GUARANTEE:
This indicator uses strict non-repainting Pine Script v6 syntax. Higher timeframe security requests fetch only closed completed bars (lookahead = barmerge.lookahead_off) to prevent lookahead bias or hindsight repainting.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。