OPEN-SOURCE SCRIPT
Reversal Detector [Scalping-Algo]

Reversal Detector - Volume-Based Price Structure Analysis
───────────────────────────────────────────
WHAT IT DOES
This indicator identifies potential reversal zones by analyzing price structure combined with volume. Instead of using traditional overbought/oversold readings or single candlestick patterns, it looks for a specific two-phase setup:
Phase 1 - Anchor Detection:
The script scans for bars where price closes beyond ALL previous bars in the lookback period. For a bullish setup, the close must be lower than every low of the past N candles (default 20). This represents an extreme extension, not just a "lower low." Volume on this bar should exceed 2x the average to confirm real participation.
Phase 2 - Confirmation:
After an anchor forms, the indicator waits for price to reverse back through the anchor bar's range. This must occur within a set number of bars (default 3). If price continues making new extremes instead, the setup is cancelled.
────────────────────────────────────────────────────────────────
HOW TO READ THE SIGNALS
B Labels (Green, below price) = Bullish reversal confirmed
S Labels (Red, above price) = Bearish reversal confirmed
Each signal shows a score from 3/5 to 5/5:
- 3/5 = Basic confirmation met
- 4/5 = Good volume on anchor or confirmation
- 5/5 = Strong volume + aligned with 200 EMA trend
Dashed Boxes = Pending setup waiting for confirmation
- Green box = Bullish setup in progress
- Red box = Bearish setup in progress
Status Panel (bottom right):
- Shows current state (Scanning / Bull Setup / Bear Setup)
- Countdown for confirmation window
- Current volume condition
────────────────────────────────────────────────────────────────
HOW TO USE
Entry Approach:
1. Wait for a confirmed signal (B or S label appears)
2. Higher scores (4/5 or 5/5) indicate better quality setups
3. Consider the overall trend context - signals aligned with the 200 EMA direction tend to work better
Stop Placement:
- For long entries: below the anchor bar's low
- For short entries: above the anchor bar's high
The boxes show you the anchor zone while waiting for confirmation, which can help visualize the invalidation level.
────────────────────────────────────────────────────────────────
SETTINGS
Structure Settings:
- Lookback Period (default 20): How many bars back to check for the breakout. Lower = more setups but less extreme. Higher = fewer but more significant extensions.
- Confirmation Bars (default 3): Maximum bars allowed for price to reverse. Tighter window = stricter filter.
Volume Settings:
- Use Volume Filter: Toggle volume requirement on/off
- Volume MA Length (default 20): Period for average volume calculation
- Anchor Volume Multiple (default 2.0): Required volume spike on anchor bar
- Confirm Volume Multiple (default 1.2): Volume threshold on confirmation bar
Visual Settings:
- Trend EMA Length (default 200): Used for trend alignment scoring
- Show Pending Setups: Display the dashed boxes for active setups
- Show Status Panel: Display the info table
- Colors and label size customization
────────────────────────────────────────────────────────────────
WHAT MAKES THIS DIFFERENT
The core idea is requiring price to break beyond EVERY bar in the lookback range, not just make a swing high/low. This filters out minor pullbacks and focuses on genuine extensions where price has moved significantly.
The two-phase approach (anchor then confirmation) helps avoid catching falling knives - you're not entering just because price is extended, but waiting for actual reversal evidence.
Volume integration adds another layer. The anchor bar needs elevated volume to confirm real selling/buying pressure, not just a gap or illiquid move.
────────────────────────────────────────────────────────────────
SUGGESTED USE
Works on any timeframe, but I find it most useful on 5-15 minute charts for intraday setups.
Combine with:
- Key support/resistance levels
- Higher timeframe trend direction
- Market context (avoid during major news)
The indicator identifies the pattern mechanically - it doesn't predict outcomes. Use proper position sizing and always have a stop loss plan.
────────────────────────────────────────────────────────────────
ALERTS INCLUDED
- Bullish Reversal
- Bearish Reversal
- Any Reversal
- Strong Bullish (4/5 or higher)
- Strong Bearish (4/5 or higher)
────────────────────────────────────────────────────────────────
───────────────────────────────────────────
WHAT IT DOES
This indicator identifies potential reversal zones by analyzing price structure combined with volume. Instead of using traditional overbought/oversold readings or single candlestick patterns, it looks for a specific two-phase setup:
Phase 1 - Anchor Detection:
The script scans for bars where price closes beyond ALL previous bars in the lookback period. For a bullish setup, the close must be lower than every low of the past N candles (default 20). This represents an extreme extension, not just a "lower low." Volume on this bar should exceed 2x the average to confirm real participation.
Phase 2 - Confirmation:
After an anchor forms, the indicator waits for price to reverse back through the anchor bar's range. This must occur within a set number of bars (default 3). If price continues making new extremes instead, the setup is cancelled.
────────────────────────────────────────────────────────────────
HOW TO READ THE SIGNALS
B Labels (Green, below price) = Bullish reversal confirmed
S Labels (Red, above price) = Bearish reversal confirmed
Each signal shows a score from 3/5 to 5/5:
- 3/5 = Basic confirmation met
- 4/5 = Good volume on anchor or confirmation
- 5/5 = Strong volume + aligned with 200 EMA trend
Dashed Boxes = Pending setup waiting for confirmation
- Green box = Bullish setup in progress
- Red box = Bearish setup in progress
Status Panel (bottom right):
- Shows current state (Scanning / Bull Setup / Bear Setup)
- Countdown for confirmation window
- Current volume condition
────────────────────────────────────────────────────────────────
HOW TO USE
Entry Approach:
1. Wait for a confirmed signal (B or S label appears)
2. Higher scores (4/5 or 5/5) indicate better quality setups
3. Consider the overall trend context - signals aligned with the 200 EMA direction tend to work better
Stop Placement:
- For long entries: below the anchor bar's low
- For short entries: above the anchor bar's high
The boxes show you the anchor zone while waiting for confirmation, which can help visualize the invalidation level.
────────────────────────────────────────────────────────────────
SETTINGS
Structure Settings:
- Lookback Period (default 20): How many bars back to check for the breakout. Lower = more setups but less extreme. Higher = fewer but more significant extensions.
- Confirmation Bars (default 3): Maximum bars allowed for price to reverse. Tighter window = stricter filter.
Volume Settings:
- Use Volume Filter: Toggle volume requirement on/off
- Volume MA Length (default 20): Period for average volume calculation
- Anchor Volume Multiple (default 2.0): Required volume spike on anchor bar
- Confirm Volume Multiple (default 1.2): Volume threshold on confirmation bar
Visual Settings:
- Trend EMA Length (default 200): Used for trend alignment scoring
- Show Pending Setups: Display the dashed boxes for active setups
- Show Status Panel: Display the info table
- Colors and label size customization
────────────────────────────────────────────────────────────────
WHAT MAKES THIS DIFFERENT
The core idea is requiring price to break beyond EVERY bar in the lookback range, not just make a swing high/low. This filters out minor pullbacks and focuses on genuine extensions where price has moved significantly.
The two-phase approach (anchor then confirmation) helps avoid catching falling knives - you're not entering just because price is extended, but waiting for actual reversal evidence.
Volume integration adds another layer. The anchor bar needs elevated volume to confirm real selling/buying pressure, not just a gap or illiquid move.
────────────────────────────────────────────────────────────────
SUGGESTED USE
Works on any timeframe, but I find it most useful on 5-15 minute charts for intraday setups.
Combine with:
- Key support/resistance levels
- Higher timeframe trend direction
- Market context (avoid during major news)
The indicator identifies the pattern mechanically - it doesn't predict outcomes. Use proper position sizing and always have a stop loss plan.
────────────────────────────────────────────────────────────────
ALERTS INCLUDED
- Bullish Reversal
- Bearish Reversal
- Any Reversal
- Strong Bullish (4/5 or higher)
- Strong Bearish (4/5 or higher)
────────────────────────────────────────────────────────────────
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Get exclusive indicators & Alerts: scalping-algo.com
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Get exclusive indicators & Alerts: scalping-algo.com
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.