OPEN-SOURCE SCRIPT
已更新 Smart Money Failure Detector

This indicator identifies moments when price fakes a breakout above a key high or below a key low, only to get violently rejected back inside the range. These are known as liquidity grabs or stop hunts moments where smart money runs retail breakout traders out of their positions before reversing hard in the opposite direction.
HOW IT WORKS
The indicator defines a dynamic range using a configurable lookback period. When price sweeps above the range high or below the range low but closes back inside with a strong reversal body, a rejection wick larger than the body, and a volume spike above average therefore a trap is confirmed.
Two trap types are detected:
→ Single-bar trap — the entire sweep and rejection happens within one candle
→ Multi-bar trap — price holds outside the range for a few candles before failing and closing back inside with conviction
SIGNAL TYPES
🐂 Bull Trap → SHORT
Price swept above the high, rejected, and closed bearish. Sellers are now in control.
🐻 Bear Trap → LONG
Price swept below the low, rejected, and closed bullish. Buyers absorbed all the selling.
WHAT APPEARS ON THE CHART
→ Triangle marker above or below the trap candle
→ Background highlight on the trap candle
→ Dashed stop line plotted at the wick tip
→ Dashed target line at your chosen Risk:Reward distance
→ Label showing the exact stop and target price
STOP LOSS LOGIC
The stop is placed at the extreme of the sweep wick. The high of the trap candle for shorts, the low for longs. If price returns to that level the trap thesis is invalidated. The target is the stop distance multiplied by your R:R setting, default is 2:1.
SETTINGS
Range Lookback — bars used to define the prior high and low
Max Bars to Close Back Inside — how long the multi-bar trap window stays open after a breakout
Volume Spike Multiplier — how far above average volume must be to confirm smart money activity
Min Body % — minimum body size relative to the full candle range to ensure reversal conviction
Min Wick Ratio — minimum rejection wick to body ratio to confirm a hard sweep occurred
Risk:Reward Target — how much risk to reward you want
RECOMMENDED USAGE
Best used on custom Risk:reward and other custom settings as all assets work very different to each other. Please do some backtests before live trading.
─────────────────────────────────────────
HOW IT WORKS
The indicator defines a dynamic range using a configurable lookback period. When price sweeps above the range high or below the range low but closes back inside with a strong reversal body, a rejection wick larger than the body, and a volume spike above average therefore a trap is confirmed.
Two trap types are detected:
→ Single-bar trap — the entire sweep and rejection happens within one candle
→ Multi-bar trap — price holds outside the range for a few candles before failing and closing back inside with conviction
SIGNAL TYPES
🐂 Bull Trap → SHORT
Price swept above the high, rejected, and closed bearish. Sellers are now in control.
🐻 Bear Trap → LONG
Price swept below the low, rejected, and closed bullish. Buyers absorbed all the selling.
WHAT APPEARS ON THE CHART
→ Triangle marker above or below the trap candle
→ Background highlight on the trap candle
→ Dashed stop line plotted at the wick tip
→ Dashed target line at your chosen Risk:Reward distance
→ Label showing the exact stop and target price
STOP LOSS LOGIC
The stop is placed at the extreme of the sweep wick. The high of the trap candle for shorts, the low for longs. If price returns to that level the trap thesis is invalidated. The target is the stop distance multiplied by your R:R setting, default is 2:1.
SETTINGS
Range Lookback — bars used to define the prior high and low
Max Bars to Close Back Inside — how long the multi-bar trap window stays open after a breakout
Volume Spike Multiplier — how far above average volume must be to confirm smart money activity
Min Body % — minimum body size relative to the full candle range to ensure reversal conviction
Min Wick Ratio — minimum rejection wick to body ratio to confirm a hard sweep occurred
Risk:Reward Target — how much risk to reward you want
RECOMMENDED USAGE
Best used on custom Risk:reward and other custom settings as all assets work very different to each other. Please do some backtests before live trading.
─────────────────────────────────────────
版本注释
just a small change开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。