OPEN-SOURCE SCRIPT
PV: Perfect Signal - Advanced Trading System

# Perfect Signal - Advanced Trading System Documentation
## Overview
A comprehensive Pine Script indicator for TradingView designed for both **intraday** and **swing trading**. This system combines institutional-level analysis with volume-centric decision-making to identify high-probability entry and exit points while filtering out fake moves and low-conviction signals.
---
## 🎯 Core Philosophy
### Volume-First Approach
The script prioritizes **volume analysis** as the primary confirmation factor. Price movements without volume support are flagged as fake moves and filtered out, preventing entries on dead-cat bounces or weak pullbacks.
### Multi-Timeframe Context
Supply and demand zones persist across **multiple days** (configurable 1-20 days), incorporating pre-market data to identify institutional levels that smart money respects over time.
### Smart Signal Filtering
- Avoids sideways/choppy markets using ADX
- Requires exceptional volume for counter-trend trades
- Detects volume divergence (price moves without volume)
- Implements momentum confirmation before entry
---
## 🔧 Key Features
### 1. Multi-Day Supply & Demand Zones
**What it does:**
- Identifies pivot highs (supply/resistance) and pivot lows (demand/support) over configurable lookback periods
- Tracks zones across multiple trading days with timestamps
- Automatically expires old zones based on persistence settings
- Distinguishes between "AT" zone and "NEAR" zone for early warnings
**Settings:**
- `Supply/Demand Zone Lookback`: 10 bars (how far back to look for pivots)
- `Zone Persistence (Days)`: 5 days (how long zones remain active)
- `Zone Test Count (Strength)`: 2 tests (minimum touches to validate zone)
- `Zone Tolerance %`: 1.5% (price proximity required)
- `Use Pre-Market Data`: Enabled (includes extended hours)
**Visual Indicators:**
- Red circles: Supply zones (resistance)
- Green circles: Demand zones (support)
- Dark background: Currently AT a zone
- Light background: NEAR a zone (approaching)
### 2. Institutional Activity Detection
**What it does:**
- Identifies "big candles" that are 1.8x larger than ATR
- Requires strong volume (2x normal spike) to confirm institutional participation
- Flags buying at demand zones and selling at supply zones
- Marks extreme volume bars with tiny circles
**Logic:**
```
Big Bull Candle = (Body > ATR * 1.8) AND (Close > Open) AND (Volume > MA * 2.0)
Institutional Buy = Big Bull Candle AT/NEAR Demand Zone
```
**Visual Indicators:**
- Bright green labels: Institutional buying (INST)
- Bright red labels: Institutional selling (INST)
- Lime/red circles: Extreme volume bars
- Orange labels: Counter-trend institutional trades (⚠️)
### 3. Volume Trend Analysis
**What it does:**
- Tracks volume trends over 3 consecutive bars
- Categorizes volume into three tiers: Spike (1.5x), Strong (2.0x), Extreme (3.0x)
- Detects volume divergence (price moves without volume support)
- Requires volume trending UP for V-shape recoveries
**Volume Tiers:**
- **Normal Spike**: 1.5x average volume
- **Strong Volume**: 2.0x average volume (required for most signals)
- **Extreme Volume**: 3.0x average volume (institutional level)
**Divergence Detection:**
- Compares 3-bar price change vs 3-bar average volume
- Flags as fake if price moves but volume < 80% of average
- Blocks all buy/sell signals during divergence
- Shows orange background warning
**Info Panel Display:**
- `1.5x⚡` = Extreme volume
- `1.5x↑` = Strong volume with uptrend
- `1.5x⚠️` = Volume divergence warning
- `Vol Trend: UP ↑` = Volume increasing over 3 bars
### 4. V-Shape Recovery Pattern
**What it does:**
- Detects sharp drops followed by strong recoveries (V-shape up)
- Detects sharp rallies followed by declines (inverse V-shape down)
- Requires RSI confirmation (oversold for buy, overbought for sell)
- Demands strong volume AND volume trending UP
**Buy Signal Requirements:**
- Price dropped at least 3% from recent high
- Recovered at least 1.8% from low
- RSI < 40 (but above extreme oversold 20)
- Strong volume (2.0x average)
- Volume trending UP over 3 bars
- No volume divergence detected
**Sell Signal Requirements:**
- Price rallied at least 3% from recent low
- Declined at least 1.8% from high
- RSI > 60 (but below extreme overbought 80)
- Strong volume (2.0x average)
- Volume trending UP over 3 bars
- No volume divergence detected
**Visual Indicators:**
- Label shows "V-REC" for recoveries
- Label shows "V-DEC" for declines
- Lightning bolt (⚡) for early entries
### 5. RSI Extreme Reversals
**What it does:**
- Catches reversals from extreme RSI levels (< 20 or > 80)
- Waits for momentum shift (2 consecutive bars)
- Requires strong volume confirmation
- Filters out moves with volume divergence
**Recovery Logic (Buy):**
- RSI was below 20 in last 3 bars
- RSI rising for 2 consecutive bars
- Strong volume present
- Price closing higher
- No volume divergence
**Decline Logic (Sell):**
- RSI was above 80 in last 3 bars
- RSI falling for 2 consecutive bars
- Strong volume present
- Price closing lower
- No volume divergence
### 6. Counter-Trend Protection
**What it does:**
- Identifies risky trades (buying in downtrend, selling in uptrend)
- Requires EXCEPTIONAL volume (2.5x average) for counter-trend entries
- Demands volume trending UP (not declining)
- Shows warning symbol (⚠️) on labels
- Uses orange color for counter-trend signals
**Logic:**
```
Counter-Trend Buy = Downtrend AND Bull Score >= 4 AND Volume > MA * 2.5 AND Vol Trend Up
Counter-Trend Sell = Uptrend AND Bear Score >= 4 AND Volume > MA * 2.5 AND Vol Trend Up
```
**Purpose:**
Prevents buying fake recoveries in downtrends or selling weak pullbacks in uptrends unless volume is exceptional, indicating real institutional interest.
### 7. Sideways Market Filter
**What it does:**
- Uses ADX (Average Directional Index) to measure trend strength
- Checks Bollinger Band width for consolidation
- Blocks all signals when market is choppy
- Shows gray background when sideways
**Filter Logic:**
```
Sideways = (ADX < 25) OR (BB Width < 3%)
No Signals Allowed When Sideways = True
```
**Settings:**
- `ADX Period`: 14 bars
- `ADX Threshold`: 25 (below = sideways)
- `Enable Sideways Filter`: True
### 8. Early Entry System
**What it does:**
- Bypasses normal 3-bar wait for strong signals
- Requires institutional or V-shape patterns
- Demands strong momentum and volume
- Allows entry after just 2 bars if conditions are exceptional
**Early Entry Criteria:**
- Institutional signal OR V-shape signal detected
- Strong momentum (price AND EMA rising/falling)
- Strong volume (2.0x average)
- No volume divergence
- Market trending (not sideways)
- For counter-trend: Requires EXTREME volume (3.0x)
**Visual Indicators:**
- Lightning bolt (⚡) added to signal label
- Shows "INST⚡" or "V-REC⚡"
---
## 📊 Scoring System
### Bullish Score (Max 10 points)
**Base Conditions (1 point each):**
1. **Uptrend**: EMA(9) > EMA(21) AND Close > EMA(50) AND SuperTrend bullish
2. **Price Strength**: Close > EMA(9) AND Close > VWAP
3. **Fresh Momentum**: EMA(9) crossing above EMA(21)
4. **Healthy RSI**: RSI between 50-70 (not overbought)
5. **Volume Confirmation**: Volume > 1.5x average AND no divergence
6. **Above Support**: Low > SuperTrend level
**Advanced Conditions (2 points each):**
7. **Institutional Buying**: Big candle at demand zone (2 points)
8. **V-Shape/RSI Recovery**: Strong recovery pattern (2 points)
### Bearish Score (Max 10 points)
**Base Conditions (1 point each):**
1. **Downtrend**: EMA(9) < EMA(21) AND Close < EMA(50) AND SuperTrend bearish
2. **Price Weakness**: Close < EMA(9) AND Close < VWAP
3. **Fresh Momentum Down**: EMA(9) crossing below EMA(21)
4. **Bearish RSI**: RSI between 30-50 (not oversold)
5. **Volume Confirmation**: Volume > 1.5x average AND no divergence
6. **Below Resistance**: High < SuperTrend level
**Advanced Conditions (2 points each):**
7. **Institutional Selling**: Big candle at supply zone (2 points)
8. **Inverse V-Shape/RSI Decline**: Strong decline pattern (2 points)
### Signal Generation
**Buy Signal:**
- Bull Score ≥ 4/10 (configurable)
- Bear Score < 3/10
- At least 3 bars since last signal
- Market trending (not sideways)
- No volume divergence
- Price AND EMA rising
- If counter-trend: Volume > 2.5x average
**Sell Signal:**
- Bear Score ≥ 4/10 (configurable)
- Bull Score < 3/10
- At least 3 bars since last signal
- Market trending (not sideways)
- No volume divergence
- Price AND EMA falling
- If counter-trend: Volume > 2.5x average
---
## 🎨 Visual System
### Chart Overlays
**Trend Lines:**
- Blue line: Fast EMA (9)
- Orange line: Slow EMA (21)
- Green/Red line: SuperTrend (3.0 multiplier, 10 ATR)
- Yellow dots: VWAP
**Supply/Demand:**
- Red circles: Supply zones (resistance)
- Green circles: Demand zones (support)
**Background Colors:**
- Dark red: AT supply zone
- Dark green: AT demand zone
- Light red: NEAR supply zone
- Light green: NEAR demand zone
- Gray: Sideways market
- Orange: Volume divergence warning
**Signal Labels:**
- Green arrows: BUY signals
- Red arrows: SELL signals
- Text shows reason: INST, V-REC, V-DEC, TREND
- Lightning bolt (⚡): Early entry
- Warning symbol (⚠️): Counter-trend
**Volume Markers:**
- Tiny lime circles: Extreme bullish volume
- Tiny red circles: Extreme bearish volume
### Info Panel (Top Right)
**14-row dashboard showing:**
1. **Trend**: UP ↑ / DN ↓ / FLAT →
2. **Price vs VWAP**: ABOVE / BELOW
3. **RSI**: Current value (colored by level)
4. **Volume**: Ratio with indicators (⚡↑⚠️)
5. **Market**: TRENDING / SIDEWAYS / NEUTRAL
6. **ADX**: Trend strength value
7. **Bull Score**: Current score out of 10
8. **Bear Score**: Current score out of 10
9. **Zone**: SUPPLY / DEMAND / ~SUPPLY / ~DEMAND / NONE
10. **Position**: LONG / SHORT / NONE (tracks last signal)
11. **Signal**: BUY / SELL / HOLD (current condition)
12. **ATR**: Average True Range value
13. **Vol Trend**: UP ↑ / DN ↓ / FLAT (3-bar trend)
---
## ⚙️ Configuration Guide
### For Intraday Trading (5min - 15min charts)
```
Fast EMA: 9
Slow EMA: 21
Trend Filter EMA: 50
Min Score: 4
Min Bars Between Signals: 3
Enable Early Entry: Yes
ADX Threshold: 20 (lower for intraday)
Volume Spike Multiplier: 1.5
Zone Persistence: 2 days
```
### For Swing Trading (1hr - Daily charts)
```
Fast EMA: 9
Slow EMA: 21
Trend Filter EMA: 50
Min Score: 5
Min Bars Between Signals: 5
Enable Early Entry: Yes
ADX Threshold: 25
Volume Spike Multiplier: 1.5
Zone Persistence: 5-10 days
```
### Conservative Settings (Fewer signals, higher quality)
```
Min Score: 6
Big Candle Size: 2.0x ATR
Volume Spike: 2.0x
Counter-Trend Volume: 3.0x
Zone Strength: 3 tests
Enable Sideways Filter: Yes
```
### Aggressive Settings (More signals, faster entries)
```
Min Score: 3
Big Candle Size: 1.5x ATR
Volume Spike: 1.3x
Counter-Trend Volume: 2.0x
Zone Strength: 1 test
Enable Early Entry: Yes
Min Bars Between Signals: 2
```
---
## 🔔 Alert System
### Primary Alerts
1. **Buy Signal**: Regular buy entry (score ≥ 4)
2. **Sell Signal**: Regular sell entry (score ≥ 4)
3. **Early Buy Entry**: Fast institutional/V-shape buy (⚡)
4. **Early Sell Entry**: Fast institutional/V-shape sell (⚡)
### Warning Alerts
5. **Counter-Trend Buy**: Buying in downtrend with exceptional volume (⚠️)
6. **Counter-Trend Sell**: Selling in uptrend with exceptional volume (⚠️)
7. **Volume Divergence Up**: Price rising without volume (fake move)
8. **Volume Divergence Down**: Price falling without volume (fake move)
### Information Alerts
9. **Institutional Buy**: Big candle at demand zone (🏦)
10. **Institutional Sell**: Big candle at supply zone (🏦)
11. **V-Shape Recovery**: Oversold bounce detected (📈)
12. **Inverse V-Shape**: Overbought decline detected (📉)
---
## 🎯 Trading Strategy Guide
### Entry Rules
**For Long (Buy):**
1. Wait for BUY signal label on chart
2. Verify bull score ≥ 4/10 in info panel
3. Confirm volume shows ↑ or ⚡ (not ⚠️)
4. Check market status is TRENDING (not SIDEWAYS)
5. Prefer signals at/near DEMAND zones
6. Look for INST or V-REC labels (stronger signals)
7. Be cautious with ⚠️ counter-trend signals
**For Short (Sell):**
1. Wait for SELL signal label on chart
2. Verify bear score ≥ 4/10 in info panel
3. Confirm volume shows ↑ or ⚡ (not ⚠️)
4. Check market status is TRENDING (not SIDEWAYS)
5. Prefer signals at/near SUPPLY zones
6. Look for INST or V-DEC labels (stronger signals)
7. Be cautious with ⚠️ counter-trend signals
### Exit Rules
**For Long Positions:**
- Exit on SELL signal (label shows "EXIT & SELL")
- Consider partial exit if entering SUPPLY zone
- Trail stop-loss below SuperTrend line
- Exit if volume divergence appears (orange background)
- Exit if market becomes SIDEWAYS for extended period
**For Short Positions:**
- Exit on BUY signal (label shows "EXIT & BUY")
- Consider partial exit if entering DEMAND zone
- Trail stop-loss above SuperTrend line
- Exit if volume divergence appears (orange background)
- Exit if market becomes SIDEWAYS for extended period
### Risk Management
**Stop-Loss Placement:**
- Long: Below recent demand zone or SuperTrend
- Short: Above recent supply zone or SuperTrend
- Use 1.5x ATR as minimum stop distance
**Position Sizing:**
- Regular signals (score 4-6): Standard position
- Strong signals (score 7-8): 1.5x position
- Institutional signals (score 9-10): 2x position
- Counter-trend signals (⚠️): 0.5x position (risky)
---
## 🚫 What to Avoid
### Don't Trade When:
1. **Orange background**: Volume divergence detected (fake move)
2. **Gray background**: Market is sideways/choppy
3. **Volume shows ⚠️**: Volume warning in info panel
4. **Market = SIDEWAYS**: Info panel shows sideways condition
5. **Score < 4**: Both bull and bear scores are low
6. **After hours**: Within 10 minutes of market open (optional setting)
### Be Cautious With:
1. **⚠️ Counter-trend signals**: Orange labels require exceptional volume
2. **Signals far from zones**: Prefer entries at/near supply/demand zones
3. **Low volume conditions**: Volume < 1.0x average
4. **Conflicting signals**: Bull score AND bear score both high
5. **Rapid signal changes**: Multiple signals in short time (increase min_bars)
---
## 🔍 Troubleshooting
### Too Many Signals
- Increase `Min Score` from 4 to 5 or 6
- Increase `Min Bars Between Signals` from 3 to 5
- Disable `Enable Early Entry`
- Increase `Volume Spike Multiplier` to 2.0
- Increase `Big Candle Size` to 2.0 or higher
### Too Few Signals
- Decrease `Min Score` from 4 to 3
- Decrease `Min Bars Between Signals` from 3 to 2
- Enable `Enable Early Entry`
- Decrease `Zone Strength` from 2 to 1
- Widen `Zone Tolerance %` from 1.5% to 2.0%
### False Signals
- Enable `Sideways Filter` if disabled
- Increase `ADX Threshold` from 25 to 30
- Increase `Counter-Trend Volume Required` from 2.5x to 3.0x
- Increase `Zone Strength` from 2 to 3
- Check that `Volume Trend Bars` is set to 3
### Missing Good Trades
- Decrease `Min Score` to 3
- Enable `Enable Early Entry`
- Decrease `Big Candle Size` to 1.5x
- Increase `Zone Persistence` to 10 days
- Decrease `Min Bars Between Signals` to 2
---
## 📈 Best Practices
1. **Confirm with higher timeframe**: Check daily chart for overall trend
2. **Wait for volume**: Never trade without volume confirmation
3. **Respect the zones**: Best signals occur at supply/demand levels
4. **Watch for divergence**: Orange backgrounds are warnings, not entries
5. **Use multiple confirmations**: Prefer signals with high scores (7-10)
6. **Be patient**: Quality over quantity - wait for clear setups
7. **Manage risk**: Always use stop-losses based on ATR or zones
8. **Track performance**: Monitor which signal types work best for your style
---
## 📝 Technical Notes
### Performance Optimization
- Script uses arrays for zone storage (max 30 zones)
- Zones automatically expire after persistence period
- Volume calculations cached for efficiency
- Visual elements are conditional (can be hidden)
### Pine Script Version
- Written in Pine Script v6
- Compatible with TradingView Premium/Pro
- Requires `max_labels_count=500` and `max_lines_count=500`
### Data Requirements
- Works on any timeframe (tested 5min to Daily)
- Requires volume data (won't work on Heikin Ashi without volume)
- Pre-market data optional (enabled by default)
- Historical data needed for zone persistence
---
## 🎓 Understanding the Signals
### Signal Label Legend
- **TREND**: Basic trend-following signal (6 base conditions met)
- **INST**: Institutional activity at zone (big candle + volume)
- **V-REC**: V-shape recovery pattern (oversold bounce)
- **V-DEC**: Inverse V-shape decline (overbought drop)
- **⚡**: Early entry (bypass normal wait time)
- **⚠️**: Counter-trend warning (risky trade)
### Score Interpretation
- **3-4**: Marginal signal, wait for confirmation
- **5-6**: Good signal, standard entry
- **7-8**: Strong signal, increase position size
- **9-10**: Exceptional signal, maximum conviction
### Volume Interpretation
- **1.0x**: Below average, avoid trading
- **1.5x**: Spike, minimum for entry
- **2.0x↑**: Strong, ideal for entries
- **3.0x⚡**: Extreme, institutional level
- **⚠️**: Divergence, fake move detected
---
## 💡 Tips for Success
1. **Start conservative**: Begin with min_score=5 and adjust down if needed
2. **Backtest first**: Test on historical data before live trading
3. **Use with other tools**: Combine with your existing analysis
4. **Adapt to market**: Adjust settings for current volatility
5. **Trust the volume**: When volume says no, don't trade
6. **Respect the zones**: Best trades happen at key levels
7. **Keep it simple**: Don't override too many signals manually
8. **Review performance**: Track which patterns work best for you
---
## 📧 Support & Questions
This indicator is designed to be self-contained and comprehensive. All logic is transparent and documented within the code comments. Modify settings to match your trading style and risk tolerance.
**Remember**: No indicator is perfect. Always use proper risk management and combine technical analysis with fundamental research.
---
*Version: 2.0 - Volume-Centric Advanced Trading System*
*Last Updated: 2026*
## Overview
A comprehensive Pine Script indicator for TradingView designed for both **intraday** and **swing trading**. This system combines institutional-level analysis with volume-centric decision-making to identify high-probability entry and exit points while filtering out fake moves and low-conviction signals.
---
## 🎯 Core Philosophy
### Volume-First Approach
The script prioritizes **volume analysis** as the primary confirmation factor. Price movements without volume support are flagged as fake moves and filtered out, preventing entries on dead-cat bounces or weak pullbacks.
### Multi-Timeframe Context
Supply and demand zones persist across **multiple days** (configurable 1-20 days), incorporating pre-market data to identify institutional levels that smart money respects over time.
### Smart Signal Filtering
- Avoids sideways/choppy markets using ADX
- Requires exceptional volume for counter-trend trades
- Detects volume divergence (price moves without volume)
- Implements momentum confirmation before entry
---
## 🔧 Key Features
### 1. Multi-Day Supply & Demand Zones
**What it does:**
- Identifies pivot highs (supply/resistance) and pivot lows (demand/support) over configurable lookback periods
- Tracks zones across multiple trading days with timestamps
- Automatically expires old zones based on persistence settings
- Distinguishes between "AT" zone and "NEAR" zone for early warnings
**Settings:**
- `Supply/Demand Zone Lookback`: 10 bars (how far back to look for pivots)
- `Zone Persistence (Days)`: 5 days (how long zones remain active)
- `Zone Test Count (Strength)`: 2 tests (minimum touches to validate zone)
- `Zone Tolerance %`: 1.5% (price proximity required)
- `Use Pre-Market Data`: Enabled (includes extended hours)
**Visual Indicators:**
- Red circles: Supply zones (resistance)
- Green circles: Demand zones (support)
- Dark background: Currently AT a zone
- Light background: NEAR a zone (approaching)
### 2. Institutional Activity Detection
**What it does:**
- Identifies "big candles" that are 1.8x larger than ATR
- Requires strong volume (2x normal spike) to confirm institutional participation
- Flags buying at demand zones and selling at supply zones
- Marks extreme volume bars with tiny circles
**Logic:**
```
Big Bull Candle = (Body > ATR * 1.8) AND (Close > Open) AND (Volume > MA * 2.0)
Institutional Buy = Big Bull Candle AT/NEAR Demand Zone
```
**Visual Indicators:**
- Bright green labels: Institutional buying (INST)
- Bright red labels: Institutional selling (INST)
- Lime/red circles: Extreme volume bars
- Orange labels: Counter-trend institutional trades (⚠️)
### 3. Volume Trend Analysis
**What it does:**
- Tracks volume trends over 3 consecutive bars
- Categorizes volume into three tiers: Spike (1.5x), Strong (2.0x), Extreme (3.0x)
- Detects volume divergence (price moves without volume support)
- Requires volume trending UP for V-shape recoveries
**Volume Tiers:**
- **Normal Spike**: 1.5x average volume
- **Strong Volume**: 2.0x average volume (required for most signals)
- **Extreme Volume**: 3.0x average volume (institutional level)
**Divergence Detection:**
- Compares 3-bar price change vs 3-bar average volume
- Flags as fake if price moves but volume < 80% of average
- Blocks all buy/sell signals during divergence
- Shows orange background warning
**Info Panel Display:**
- `1.5x⚡` = Extreme volume
- `1.5x↑` = Strong volume with uptrend
- `1.5x⚠️` = Volume divergence warning
- `Vol Trend: UP ↑` = Volume increasing over 3 bars
### 4. V-Shape Recovery Pattern
**What it does:**
- Detects sharp drops followed by strong recoveries (V-shape up)
- Detects sharp rallies followed by declines (inverse V-shape down)
- Requires RSI confirmation (oversold for buy, overbought for sell)
- Demands strong volume AND volume trending UP
**Buy Signal Requirements:**
- Price dropped at least 3% from recent high
- Recovered at least 1.8% from low
- RSI < 40 (but above extreme oversold 20)
- Strong volume (2.0x average)
- Volume trending UP over 3 bars
- No volume divergence detected
**Sell Signal Requirements:**
- Price rallied at least 3% from recent low
- Declined at least 1.8% from high
- RSI > 60 (but below extreme overbought 80)
- Strong volume (2.0x average)
- Volume trending UP over 3 bars
- No volume divergence detected
**Visual Indicators:**
- Label shows "V-REC" for recoveries
- Label shows "V-DEC" for declines
- Lightning bolt (⚡) for early entries
### 5. RSI Extreme Reversals
**What it does:**
- Catches reversals from extreme RSI levels (< 20 or > 80)
- Waits for momentum shift (2 consecutive bars)
- Requires strong volume confirmation
- Filters out moves with volume divergence
**Recovery Logic (Buy):**
- RSI was below 20 in last 3 bars
- RSI rising for 2 consecutive bars
- Strong volume present
- Price closing higher
- No volume divergence
**Decline Logic (Sell):**
- RSI was above 80 in last 3 bars
- RSI falling for 2 consecutive bars
- Strong volume present
- Price closing lower
- No volume divergence
### 6. Counter-Trend Protection
**What it does:**
- Identifies risky trades (buying in downtrend, selling in uptrend)
- Requires EXCEPTIONAL volume (2.5x average) for counter-trend entries
- Demands volume trending UP (not declining)
- Shows warning symbol (⚠️) on labels
- Uses orange color for counter-trend signals
**Logic:**
```
Counter-Trend Buy = Downtrend AND Bull Score >= 4 AND Volume > MA * 2.5 AND Vol Trend Up
Counter-Trend Sell = Uptrend AND Bear Score >= 4 AND Volume > MA * 2.5 AND Vol Trend Up
```
**Purpose:**
Prevents buying fake recoveries in downtrends or selling weak pullbacks in uptrends unless volume is exceptional, indicating real institutional interest.
### 7. Sideways Market Filter
**What it does:**
- Uses ADX (Average Directional Index) to measure trend strength
- Checks Bollinger Band width for consolidation
- Blocks all signals when market is choppy
- Shows gray background when sideways
**Filter Logic:**
```
Sideways = (ADX < 25) OR (BB Width < 3%)
No Signals Allowed When Sideways = True
```
**Settings:**
- `ADX Period`: 14 bars
- `ADX Threshold`: 25 (below = sideways)
- `Enable Sideways Filter`: True
### 8. Early Entry System
**What it does:**
- Bypasses normal 3-bar wait for strong signals
- Requires institutional or V-shape patterns
- Demands strong momentum and volume
- Allows entry after just 2 bars if conditions are exceptional
**Early Entry Criteria:**
- Institutional signal OR V-shape signal detected
- Strong momentum (price AND EMA rising/falling)
- Strong volume (2.0x average)
- No volume divergence
- Market trending (not sideways)
- For counter-trend: Requires EXTREME volume (3.0x)
**Visual Indicators:**
- Lightning bolt (⚡) added to signal label
- Shows "INST⚡" or "V-REC⚡"
---
## 📊 Scoring System
### Bullish Score (Max 10 points)
**Base Conditions (1 point each):**
1. **Uptrend**: EMA(9) > EMA(21) AND Close > EMA(50) AND SuperTrend bullish
2. **Price Strength**: Close > EMA(9) AND Close > VWAP
3. **Fresh Momentum**: EMA(9) crossing above EMA(21)
4. **Healthy RSI**: RSI between 50-70 (not overbought)
5. **Volume Confirmation**: Volume > 1.5x average AND no divergence
6. **Above Support**: Low > SuperTrend level
**Advanced Conditions (2 points each):**
7. **Institutional Buying**: Big candle at demand zone (2 points)
8. **V-Shape/RSI Recovery**: Strong recovery pattern (2 points)
### Bearish Score (Max 10 points)
**Base Conditions (1 point each):**
1. **Downtrend**: EMA(9) < EMA(21) AND Close < EMA(50) AND SuperTrend bearish
2. **Price Weakness**: Close < EMA(9) AND Close < VWAP
3. **Fresh Momentum Down**: EMA(9) crossing below EMA(21)
4. **Bearish RSI**: RSI between 30-50 (not oversold)
5. **Volume Confirmation**: Volume > 1.5x average AND no divergence
6. **Below Resistance**: High < SuperTrend level
**Advanced Conditions (2 points each):**
7. **Institutional Selling**: Big candle at supply zone (2 points)
8. **Inverse V-Shape/RSI Decline**: Strong decline pattern (2 points)
### Signal Generation
**Buy Signal:**
- Bull Score ≥ 4/10 (configurable)
- Bear Score < 3/10
- At least 3 bars since last signal
- Market trending (not sideways)
- No volume divergence
- Price AND EMA rising
- If counter-trend: Volume > 2.5x average
**Sell Signal:**
- Bear Score ≥ 4/10 (configurable)
- Bull Score < 3/10
- At least 3 bars since last signal
- Market trending (not sideways)
- No volume divergence
- Price AND EMA falling
- If counter-trend: Volume > 2.5x average
---
## 🎨 Visual System
### Chart Overlays
**Trend Lines:**
- Blue line: Fast EMA (9)
- Orange line: Slow EMA (21)
- Green/Red line: SuperTrend (3.0 multiplier, 10 ATR)
- Yellow dots: VWAP
**Supply/Demand:**
- Red circles: Supply zones (resistance)
- Green circles: Demand zones (support)
**Background Colors:**
- Dark red: AT supply zone
- Dark green: AT demand zone
- Light red: NEAR supply zone
- Light green: NEAR demand zone
- Gray: Sideways market
- Orange: Volume divergence warning
**Signal Labels:**
- Green arrows: BUY signals
- Red arrows: SELL signals
- Text shows reason: INST, V-REC, V-DEC, TREND
- Lightning bolt (⚡): Early entry
- Warning symbol (⚠️): Counter-trend
**Volume Markers:**
- Tiny lime circles: Extreme bullish volume
- Tiny red circles: Extreme bearish volume
### Info Panel (Top Right)
**14-row dashboard showing:**
1. **Trend**: UP ↑ / DN ↓ / FLAT →
2. **Price vs VWAP**: ABOVE / BELOW
3. **RSI**: Current value (colored by level)
4. **Volume**: Ratio with indicators (⚡↑⚠️)
5. **Market**: TRENDING / SIDEWAYS / NEUTRAL
6. **ADX**: Trend strength value
7. **Bull Score**: Current score out of 10
8. **Bear Score**: Current score out of 10
9. **Zone**: SUPPLY / DEMAND / ~SUPPLY / ~DEMAND / NONE
10. **Position**: LONG / SHORT / NONE (tracks last signal)
11. **Signal**: BUY / SELL / HOLD (current condition)
12. **ATR**: Average True Range value
13. **Vol Trend**: UP ↑ / DN ↓ / FLAT (3-bar trend)
---
## ⚙️ Configuration Guide
### For Intraday Trading (5min - 15min charts)
```
Fast EMA: 9
Slow EMA: 21
Trend Filter EMA: 50
Min Score: 4
Min Bars Between Signals: 3
Enable Early Entry: Yes
ADX Threshold: 20 (lower for intraday)
Volume Spike Multiplier: 1.5
Zone Persistence: 2 days
```
### For Swing Trading (1hr - Daily charts)
```
Fast EMA: 9
Slow EMA: 21
Trend Filter EMA: 50
Min Score: 5
Min Bars Between Signals: 5
Enable Early Entry: Yes
ADX Threshold: 25
Volume Spike Multiplier: 1.5
Zone Persistence: 5-10 days
```
### Conservative Settings (Fewer signals, higher quality)
```
Min Score: 6
Big Candle Size: 2.0x ATR
Volume Spike: 2.0x
Counter-Trend Volume: 3.0x
Zone Strength: 3 tests
Enable Sideways Filter: Yes
```
### Aggressive Settings (More signals, faster entries)
```
Min Score: 3
Big Candle Size: 1.5x ATR
Volume Spike: 1.3x
Counter-Trend Volume: 2.0x
Zone Strength: 1 test
Enable Early Entry: Yes
Min Bars Between Signals: 2
```
---
## 🔔 Alert System
### Primary Alerts
1. **Buy Signal**: Regular buy entry (score ≥ 4)
2. **Sell Signal**: Regular sell entry (score ≥ 4)
3. **Early Buy Entry**: Fast institutional/V-shape buy (⚡)
4. **Early Sell Entry**: Fast institutional/V-shape sell (⚡)
### Warning Alerts
5. **Counter-Trend Buy**: Buying in downtrend with exceptional volume (⚠️)
6. **Counter-Trend Sell**: Selling in uptrend with exceptional volume (⚠️)
7. **Volume Divergence Up**: Price rising without volume (fake move)
8. **Volume Divergence Down**: Price falling without volume (fake move)
### Information Alerts
9. **Institutional Buy**: Big candle at demand zone (🏦)
10. **Institutional Sell**: Big candle at supply zone (🏦)
11. **V-Shape Recovery**: Oversold bounce detected (📈)
12. **Inverse V-Shape**: Overbought decline detected (📉)
---
## 🎯 Trading Strategy Guide
### Entry Rules
**For Long (Buy):**
1. Wait for BUY signal label on chart
2. Verify bull score ≥ 4/10 in info panel
3. Confirm volume shows ↑ or ⚡ (not ⚠️)
4. Check market status is TRENDING (not SIDEWAYS)
5. Prefer signals at/near DEMAND zones
6. Look for INST or V-REC labels (stronger signals)
7. Be cautious with ⚠️ counter-trend signals
**For Short (Sell):**
1. Wait for SELL signal label on chart
2. Verify bear score ≥ 4/10 in info panel
3. Confirm volume shows ↑ or ⚡ (not ⚠️)
4. Check market status is TRENDING (not SIDEWAYS)
5. Prefer signals at/near SUPPLY zones
6. Look for INST or V-DEC labels (stronger signals)
7. Be cautious with ⚠️ counter-trend signals
### Exit Rules
**For Long Positions:**
- Exit on SELL signal (label shows "EXIT & SELL")
- Consider partial exit if entering SUPPLY zone
- Trail stop-loss below SuperTrend line
- Exit if volume divergence appears (orange background)
- Exit if market becomes SIDEWAYS for extended period
**For Short Positions:**
- Exit on BUY signal (label shows "EXIT & BUY")
- Consider partial exit if entering DEMAND zone
- Trail stop-loss above SuperTrend line
- Exit if volume divergence appears (orange background)
- Exit if market becomes SIDEWAYS for extended period
### Risk Management
**Stop-Loss Placement:**
- Long: Below recent demand zone or SuperTrend
- Short: Above recent supply zone or SuperTrend
- Use 1.5x ATR as minimum stop distance
**Position Sizing:**
- Regular signals (score 4-6): Standard position
- Strong signals (score 7-8): 1.5x position
- Institutional signals (score 9-10): 2x position
- Counter-trend signals (⚠️): 0.5x position (risky)
---
## 🚫 What to Avoid
### Don't Trade When:
1. **Orange background**: Volume divergence detected (fake move)
2. **Gray background**: Market is sideways/choppy
3. **Volume shows ⚠️**: Volume warning in info panel
4. **Market = SIDEWAYS**: Info panel shows sideways condition
5. **Score < 4**: Both bull and bear scores are low
6. **After hours**: Within 10 minutes of market open (optional setting)
### Be Cautious With:
1. **⚠️ Counter-trend signals**: Orange labels require exceptional volume
2. **Signals far from zones**: Prefer entries at/near supply/demand zones
3. **Low volume conditions**: Volume < 1.0x average
4. **Conflicting signals**: Bull score AND bear score both high
5. **Rapid signal changes**: Multiple signals in short time (increase min_bars)
---
## 🔍 Troubleshooting
### Too Many Signals
- Increase `Min Score` from 4 to 5 or 6
- Increase `Min Bars Between Signals` from 3 to 5
- Disable `Enable Early Entry`
- Increase `Volume Spike Multiplier` to 2.0
- Increase `Big Candle Size` to 2.0 or higher
### Too Few Signals
- Decrease `Min Score` from 4 to 3
- Decrease `Min Bars Between Signals` from 3 to 2
- Enable `Enable Early Entry`
- Decrease `Zone Strength` from 2 to 1
- Widen `Zone Tolerance %` from 1.5% to 2.0%
### False Signals
- Enable `Sideways Filter` if disabled
- Increase `ADX Threshold` from 25 to 30
- Increase `Counter-Trend Volume Required` from 2.5x to 3.0x
- Increase `Zone Strength` from 2 to 3
- Check that `Volume Trend Bars` is set to 3
### Missing Good Trades
- Decrease `Min Score` to 3
- Enable `Enable Early Entry`
- Decrease `Big Candle Size` to 1.5x
- Increase `Zone Persistence` to 10 days
- Decrease `Min Bars Between Signals` to 2
---
## 📈 Best Practices
1. **Confirm with higher timeframe**: Check daily chart for overall trend
2. **Wait for volume**: Never trade without volume confirmation
3. **Respect the zones**: Best signals occur at supply/demand levels
4. **Watch for divergence**: Orange backgrounds are warnings, not entries
5. **Use multiple confirmations**: Prefer signals with high scores (7-10)
6. **Be patient**: Quality over quantity - wait for clear setups
7. **Manage risk**: Always use stop-losses based on ATR or zones
8. **Track performance**: Monitor which signal types work best for your style
---
## 📝 Technical Notes
### Performance Optimization
- Script uses arrays for zone storage (max 30 zones)
- Zones automatically expire after persistence period
- Volume calculations cached for efficiency
- Visual elements are conditional (can be hidden)
### Pine Script Version
- Written in Pine Script v6
- Compatible with TradingView Premium/Pro
- Requires `max_labels_count=500` and `max_lines_count=500`
### Data Requirements
- Works on any timeframe (tested 5min to Daily)
- Requires volume data (won't work on Heikin Ashi without volume)
- Pre-market data optional (enabled by default)
- Historical data needed for zone persistence
---
## 🎓 Understanding the Signals
### Signal Label Legend
- **TREND**: Basic trend-following signal (6 base conditions met)
- **INST**: Institutional activity at zone (big candle + volume)
- **V-REC**: V-shape recovery pattern (oversold bounce)
- **V-DEC**: Inverse V-shape decline (overbought drop)
- **⚡**: Early entry (bypass normal wait time)
- **⚠️**: Counter-trend warning (risky trade)
### Score Interpretation
- **3-4**: Marginal signal, wait for confirmation
- **5-6**: Good signal, standard entry
- **7-8**: Strong signal, increase position size
- **9-10**: Exceptional signal, maximum conviction
### Volume Interpretation
- **1.0x**: Below average, avoid trading
- **1.5x**: Spike, minimum for entry
- **2.0x↑**: Strong, ideal for entries
- **3.0x⚡**: Extreme, institutional level
- **⚠️**: Divergence, fake move detected
---
## 💡 Tips for Success
1. **Start conservative**: Begin with min_score=5 and adjust down if needed
2. **Backtest first**: Test on historical data before live trading
3. **Use with other tools**: Combine with your existing analysis
4. **Adapt to market**: Adjust settings for current volatility
5. **Trust the volume**: When volume says no, don't trade
6. **Respect the zones**: Best trades happen at key levels
7. **Keep it simple**: Don't override too many signals manually
8. **Review performance**: Track which patterns work best for you
---
## 📧 Support & Questions
This indicator is designed to be self-contained and comprehensive. All logic is transparent and documented within the code comments. Modify settings to match your trading style and risk tolerance.
**Remember**: No indicator is perfect. Always use proper risk management and combine technical analysis with fundamental research.
---
*Version: 2.0 - Volume-Centric Advanced Trading System*
*Last Updated: 2026*
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน