OPEN-SOURCE SCRIPT
Two-Sided Liquidity Trap Detector [MB]

**Two-Sided Liquidity Trap Detector [MB]**
This indicator is designed to identify potential liquidity traps around important support and resistance levels.
It detects two types of setups:
### BUY TRAP CONFIRMED
A **BUY TRAP CONFIRMED** signal means sellers may have been trapped below support.
Typical sequence:
1. Price moves below an active support level.
2. Sellers enter expecting further downside.
3. Price fails to continue lower.
4. Price reclaims the broken support.
5. A strong bullish candle confirms the recovery.
This signal may indicate a possible **long opportunity**.
A clearer interpretation is:
**Bear Trap Confirmed → Potential Buy Setup**
---
### SELL TRAP CONFIRMED
A **SELL TRAP CONFIRMED** signal means buyers may have been trapped above resistance.
Typical sequence:
1. Price moves above an active resistance level.
2. Buyers enter expecting further upside.
3. Price fails to continue higher.
4. Price falls back below resistance.
5. A strong bearish candle confirms the rejection.
This signal may indicate a possible **short opportunity**.
A clearer interpretation is:
**Bull Trap Confirmed → Potential Sell Setup**
---
## Main Features
* Detects bullish and bearish liquidity traps
* Supports both buy-side and sell-side signals
* Uses confirmed pivot levels or rolling support and resistance
* Requires price to sweep beyond a level
* Waits for price to reclaim the level
* Uses candle-body strength and closing position for confirmation
* Optional EMA trend filter
* Optional volume filter
* Displays trap zones directly on the chart
* Marks both the sweep candle and confirmation candle
* Includes alert conditions for buy and sell trap signals
* Signals are confirmed after candle close
---
## Support and Resistance Methods
### Confirmed Pivots
Uses confirmed swing highs and swing lows to identify potential support and resistance levels.
Higher pivot settings create fewer but more significant levels.
### Rolling Range
Uses the highest high and lowest low from a selected lookback period.
This method reacts more quickly but may generate more signals in sideways markets.
---
## Confirmation Filters
The indicator uses several filters to improve signal quality:
### Minimum Sweep Size
Controls how far price must move beyond support or resistance before the move is considered a liquidity sweep.
### Confirmation Body Size
Requires the reclaim candle to have a minimum body size relative to ATR.
Higher values produce fewer but stronger confirmation signals.
### Close Strength
Checks whether the confirmation candle closes near its high or low.
For buy signals, the candle should close near its high.
For sell signals, the candle should close near its low.
### Maximum Confirmation Window
Defines how many candles are allowed between the initial sweep and the confirmation.
---
## Optional EMA Filter
The EMA filter can be used to align signals with the current trend.
For buy signals:
* Price must be above the fast EMA
* Fast EMA must be above the slow EMA
For sell signals:
* Price must be below the fast EMA
* Fast EMA must be below the slow EMA
Turning this filter on may reduce countertrend signals.
---
## Optional Volume Filter
The volume filter requires the confirmation candle to have volume above its moving average.
This may help identify traps accompanied by stronger market participation.
Volume data may behave differently depending on the market and broker feed.
---
## Suggested Starting Settings
For intraday charts:
* Pivot Left: 5
* Pivot Right: 5
* Maximum Confirmation Bars: 5 to 8
* Minimum Sweep Size: 0.05 ATR
* Confirmation Body Size: 0.60 ATR
* Close Strength: 0.65
* EMA Filter: Off
* Volume Filter: Off
For cleaner but fewer signals:
* Pivot Left: 7
* Pivot Right: 7
* Confirmation Body Size: 0.80 ATR
* Close Strength: 0.70
* EMA Filter: On
---
## Trade Management Example
For a confirmed buy trap:
* Entry may be considered above the confirmation candle high
* Stop-loss may be placed below the lowest point of the trap
* Target may be the previous swing high or next resistance level
For a confirmed sell trap:
* Entry may be considered below the confirmation candle low
* Stop-loss may be placed above the highest point of the trap
* Target may be the previous swing low or next support level
The indicator does not automatically calculate risk, stop-loss, or profit targets.
---
## Alerts
The script includes alert conditions for:
* BUY Trap Confirmed
* SELL Trap Confirmed
* Any Trap Confirmed
Create the alert from the TradingView alert menu after adding the indicator to the chart.
---
## Important Notes
This indicator identifies potential liquidity sweeps and reclaim patterns. Not every signal will result in a successful reversal.
Signals may be less reliable during:
* Low-liquidity periods
* Narrow sideways markets
* High-impact news events
* Extremely volatile market conditions
* Markets with weak volume data
For better results, combine the indicator with:
* Higher-timeframe market structure
* Major support and resistance
* Session timing
* Trend direction
* Volume analysis
* Risk management
This indicator should not be used as a standalone trading system.
**Disclaimer:** This script is provided for educational and analytical purposes only. It is not financial advice. Trading involves substantial risk, and past performance does not guarantee future results.
This indicator is designed to identify potential liquidity traps around important support and resistance levels.
It detects two types of setups:
### BUY TRAP CONFIRMED
A **BUY TRAP CONFIRMED** signal means sellers may have been trapped below support.
Typical sequence:
1. Price moves below an active support level.
2. Sellers enter expecting further downside.
3. Price fails to continue lower.
4. Price reclaims the broken support.
5. A strong bullish candle confirms the recovery.
This signal may indicate a possible **long opportunity**.
A clearer interpretation is:
**Bear Trap Confirmed → Potential Buy Setup**
---
### SELL TRAP CONFIRMED
A **SELL TRAP CONFIRMED** signal means buyers may have been trapped above resistance.
Typical sequence:
1. Price moves above an active resistance level.
2. Buyers enter expecting further upside.
3. Price fails to continue higher.
4. Price falls back below resistance.
5. A strong bearish candle confirms the rejection.
This signal may indicate a possible **short opportunity**.
A clearer interpretation is:
**Bull Trap Confirmed → Potential Sell Setup**
---
## Main Features
* Detects bullish and bearish liquidity traps
* Supports both buy-side and sell-side signals
* Uses confirmed pivot levels or rolling support and resistance
* Requires price to sweep beyond a level
* Waits for price to reclaim the level
* Uses candle-body strength and closing position for confirmation
* Optional EMA trend filter
* Optional volume filter
* Displays trap zones directly on the chart
* Marks both the sweep candle and confirmation candle
* Includes alert conditions for buy and sell trap signals
* Signals are confirmed after candle close
---
## Support and Resistance Methods
### Confirmed Pivots
Uses confirmed swing highs and swing lows to identify potential support and resistance levels.
Higher pivot settings create fewer but more significant levels.
### Rolling Range
Uses the highest high and lowest low from a selected lookback period.
This method reacts more quickly but may generate more signals in sideways markets.
---
## Confirmation Filters
The indicator uses several filters to improve signal quality:
### Minimum Sweep Size
Controls how far price must move beyond support or resistance before the move is considered a liquidity sweep.
### Confirmation Body Size
Requires the reclaim candle to have a minimum body size relative to ATR.
Higher values produce fewer but stronger confirmation signals.
### Close Strength
Checks whether the confirmation candle closes near its high or low.
For buy signals, the candle should close near its high.
For sell signals, the candle should close near its low.
### Maximum Confirmation Window
Defines how many candles are allowed between the initial sweep and the confirmation.
---
## Optional EMA Filter
The EMA filter can be used to align signals with the current trend.
For buy signals:
* Price must be above the fast EMA
* Fast EMA must be above the slow EMA
For sell signals:
* Price must be below the fast EMA
* Fast EMA must be below the slow EMA
Turning this filter on may reduce countertrend signals.
---
## Optional Volume Filter
The volume filter requires the confirmation candle to have volume above its moving average.
This may help identify traps accompanied by stronger market participation.
Volume data may behave differently depending on the market and broker feed.
---
## Suggested Starting Settings
For intraday charts:
* Pivot Left: 5
* Pivot Right: 5
* Maximum Confirmation Bars: 5 to 8
* Minimum Sweep Size: 0.05 ATR
* Confirmation Body Size: 0.60 ATR
* Close Strength: 0.65
* EMA Filter: Off
* Volume Filter: Off
For cleaner but fewer signals:
* Pivot Left: 7
* Pivot Right: 7
* Confirmation Body Size: 0.80 ATR
* Close Strength: 0.70
* EMA Filter: On
---
## Trade Management Example
For a confirmed buy trap:
* Entry may be considered above the confirmation candle high
* Stop-loss may be placed below the lowest point of the trap
* Target may be the previous swing high or next resistance level
For a confirmed sell trap:
* Entry may be considered below the confirmation candle low
* Stop-loss may be placed above the highest point of the trap
* Target may be the previous swing low or next support level
The indicator does not automatically calculate risk, stop-loss, or profit targets.
---
## Alerts
The script includes alert conditions for:
* BUY Trap Confirmed
* SELL Trap Confirmed
* Any Trap Confirmed
Create the alert from the TradingView alert menu after adding the indicator to the chart.
---
## Important Notes
This indicator identifies potential liquidity sweeps and reclaim patterns. Not every signal will result in a successful reversal.
Signals may be less reliable during:
* Low-liquidity periods
* Narrow sideways markets
* High-impact news events
* Extremely volatile market conditions
* Markets with weak volume data
For better results, combine the indicator with:
* Higher-timeframe market structure
* Major support and resistance
* Session timing
* Trend direction
* Volume analysis
* Risk management
This indicator should not be used as a standalone trading system.
**Disclaimer:** This script is provided for educational and analytical purposes only. It is not financial advice. Trading involves substantial risk, and past performance does not guarantee future results.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。