OPEN-SOURCE SCRIPT
Atualizado

CVD Divergence Detector

7 928
# CVD Divergence Detector

Clean, focused divergence detection using **Cumulative Volume Delta (CVD)** - one of the most reliable reversal signals in trading.

## 🎯 What It Does

Identifies divergences between **price action** and **volume delta**:

**🔻 Bearish Divergence**: Price makes Higher High, but CVD doesn't → Expect reversal DOWN
**🔺 Bullish Divergence**: Price makes Lower Low, but CVD doesn't → Expect reversal UP

## ✨ Key Features

### Two Detection Modes

**1. Confirmed Divergences** (High Accuracy)
- Solid red/green lines
- Labels: 🔻 Bear / 🔺 Bull
- Fully confirmed pivots (9 bars default)
- Win rate: ~70-80%

**2. Early Warning Mode** ⚡ (Fast Signals)
- Dashed yellow lines
- Labels: ⚠️ Early Bear / ⚠️ Early Bull
- Fires 6+ bars earlier (3 bars default)
- Win rate: ~55-65%

### Smart Filtering
- Minimum bars between signals (prevents spam)
- Minimum CVD strength requirement (filters weak signals)
- Adjustable pivot periods for any timeframe

### Four Alert Types
- 🔻 Confirmed Bearish Divergence
- 🔺 Confirmed Bullish Divergence
- ⚠️ Early Bearish Warning
- ⚠️ Early Bullish Warning

## ⚙️ Recommended Settings

**15m Day Trading** (Best for most traders):
```
Pivot Left/Right: 9
Early Warning Right: 3
Min Bars Between: 40
Min CVD Diff: 5%
Anchor TF: 1D
```

**5m Scalping**:
```
Pivot Left/Right: 7
Early Warning Right: 2
Min Bars Between: 60
Min CVD Diff: 5%
```

**1H Swing Trading**:
```
Pivot Left/Right: 12-14
Early Warning Right: 4-5
Min Bars Between: 30
Min CVD Diff: 8%
```

## 💡 Trading Strategies

### Strategy 1: Early Entry (Scalpers)
- ⚠️ Early warning → Enter immediately
- Stop: Just beyond pivot
- Target: 1:2 R/R minimum
- Trades/day: 3-8

### Strategy 2: Scale In (Day Traders)
- ⚠️ Early warning → 25% position
- 🔻 Confirmed → Add 75%
- Move stop to breakeven
- Trades/week: 5-15

### Strategy 3: Confirmation Only (Swing Traders)
- Wait for 🔻 confirmed signal only
- Wider stops (1-2 ATR)
- Hold for bigger moves
- Trades/month: 8-20

## 🎯 How to Use

1. **Install** indicator on your chart
2. **Choose** your timeframe (15m recommended to start)
3. **Enable** Early Warning for faster signals OR disable for confirmed only
4. **Set alerts** for your preferred divergence types
5. **Combine** with support/resistance for best results

## 🔧 Tuning Guide

**Too many signals?**
- Increase Pivot Right to 12-15
- Increase Min Bars Between to 60
- Increase Min CVD Diff to 8-10%

**Signals too slow?**
- Enable Early Warning
- Decrease Early Warning Right to 2
- Decrease Pivot Right to 6-7

**Want cleaner chart?**
- Turn off labels (lines only)
- Disable early warnings (confirmed only)

## ⚠️ Important Notes

**Requirements:**
- Volume data required (works on futures, stocks, crypto)
- May not work on some forex pairs (broker-dependent)

**Performance:**
- No indicator is 100% accurate
- Always use proper risk management
- Combine with price action and S/R levels
- Quality over quantity - don't trade every signal

**Best Results:**
- Divergence AT support/resistance = high probability
- Divergence + trend reversal pattern = confluence
- Multiple timeframe confirmation = strongest signals

## 📊 What Makes This Different?

**Other divergence indicators:**
- Use RSI, MACD, or other oscillators
- Don't show actual order flow
- Often give false signals

**This indicator:**
- Uses real CVD (Cumulative Volume Delta)
- Shows actual buying/selling pressure
- Filters for quality (not quantity)
- Two modes: fast OR accurate (your choice)
- No clutter - just clean divergence lines

## 🚀 Quick Start

1. Add to chart
2. Default settings work well for 15m
3. Watch for 1 week before trading
4. Start with small size
5. Track your results

## 📈 Typical Performance

| Mode | Win Rate | Avg R/R | Best For |
|------|----------|---------|----------|
| Early Warning | 55-65% | 1:1.5 | Scalping |
| Confirmed | 70-80% | 1:2 | Swing trading |
| Both (Scale In) | 65-75% | 1:3 | Day trading |
| With Confluence | 75-85% | 1:3+ | All styles |

## 💬 Tips from Pro Traders

- "Use early warnings for entries, confirmed for validation"
- "Best at major S/R levels - skip divergences in the middle of nowhere"
- "Lower timeframes = more signals but lower quality"
- "On 15m chart, early warnings give you 1.5 hour head start"
- "Combine with volume spikes for highest probability"

## 🔔 Alert Setup

1. Click Alert button (⏰)
2. Choose "CVD Divergence Detector"
3. Select alert type
4. Configure notifications
5. Done!

## ⚙️ Settings Explained

**Delta Source:**
- Anchor Timeframe: Higher TF for CVD calculation (1D for day trading)
- Custom Lower TF: Advanced users only

**Pivot Logic:**
- Pivot Left/Right: How many bars to confirm pivot
- Early Warning Right: How fast early signals fire
- Min Bars Between: Prevents signal spam
- Min CVD Diff %: Filters weak divergences

**Visual:**
- Show Lines/Labels: Toggle display
- Colors: Customize to your preference
- Label Size: Adjust for readability

## ❓ FAQ

**Q: No signals appearing?**
- Check volume data is available
- Lower Min CVD Diff to 2-3%
- Lower Pivot Right to 5-7

**Q: Too many signals?**
- Increase filters (see Tuning Guide above)
- Turn off early warnings
- Use confirmed only

**Q: Signals too late?**
- Enable Early Warning mode
- Decrease Early Warning Right to 2-3

**Q: Works on crypto/forex?**
- Crypto: Yes (major pairs)
- Forex: Sometimes (depends on broker volume data)
- Futures/Stocks: Yes (best performance)

## 📚 Learn More

For detailed strategies, examples, and advanced techniques, check the full user guide.

---

**Remember:** This is a tool, not a crystal ball. Combine with:
- Price action analysis
- Support/resistance levels
- Risk management
- Proper position sizing

**The best trade is the one you don't force.** 🎯

---

## 📝 Version Info

**v1.0** - Initial Release
- Confirmed divergence detection
- Early warning mode
- Smart filtering system
- Four alert types
- Clean visual design

---

**Questions? Suggestions?** Drop a comment below! 👇

**Found this helpful?** Like and follow for more professional indicators! ⭐
Notas de Lançamento
# CVD Divergence Detector

Clean, focused divergence detection using **Cumulative Volume Delta (CVD)** - one of the most reliable reversal signals in trading.

## 🎯 What It Does

Identifies divergences between **price action** and **volume delta**:

**🔻 Bearish Divergence**: Price makes Higher High, but CVD doesn't → Expect reversal DOWN
**🔺 Bullish Divergence**: Price makes Lower Low, but CVD doesn't → Expect reversal UP

## ✨ Key Features

### Three Detection Modes

**1. Confirmed Divergences** (Highest Accuracy)
- Solid red/green lines
- Labels: 🔻 Bear / 🔺 Bull
- Fully confirmed pivots (9 bars default)
- Win rate: ~70-80%

**2. Early Warning Mode** ⚡ (Fast Signals)
- Dashed yellow lines
- Labels: ⚠️ Early Bear / ⚠️ Early Bull
- Fires 6+ bars earlier (3 right bars default)
- Win rate: ~55-65%

**3. Live Divergence Mode** 🚀 (Real-Time – Fastest Possible) **NEW**
- Dotted yellow lines
- Labels: ⚠️ Live Bear Forming / ⚠️ Live Bull Forming
- Detects divergence on the **current bar** as price pushes to a new extreme without CVD confirmation
- No waiting for second pivot confirmation
- Extremely fast (ideal for 5m/15m scalping & day trading)
- Slightly noisier, but gives you the earliest possible entry

### Smart Filtering
- Minimum bars between signals (prevents spam)
- Minimum CVD strength requirement (filters weak signals)
- Adjustable pivot periods for any timeframe

### Six Alert Types
- 🔻 Confirmed Bearish Divergence
- 🔺 Confirmed Bullish Divergence
- ⚠️ Early Bearish Warning
- ⚠️ Early Bullish Warning
- ⚠️ Live Bearish Forming **NEW**
- ⚠️ Live Bullish Forming **NEW**

## ⚙️ Recommended Settings

**15m Day Trading** (Best balance for most traders):
```
Pivot Left/Right: 9
Early Warning Right: 3
Min Bars Between: 40
Min CVD Diff: 5%
Anchor TF: 1D
Live Mode: ON (for fastest entries)
```

**5m Scalping**:
```
Pivot Left/Right: 6-7
Early Warning Right: 2-3
Min Bars Between: 60-80
Min CVD Diff: 5-8%
Live Mode: ON (essential for speed)
```

**1H Swing Trading**:
```
Pivot Left/Right: 12-14
Early Warning Right: 4-5
Min Bars Between: 30
Min CVD Diff: 8%
Live Mode: OFF or ON (depending on aggression)
```

## 💡 Trading Strategies

### Strategy 1: Ultra-Fast Scalping (5m)
- ⚠️ Live Forming signal → Enter immediately (50-100% position)
- Stop: Beyond recent swing
- Target: Quick 1:1.5 to 1:2
- Use Live + Early for confirmation

### Strategy 2: Aggressive Day Trading (15m)
- ⚠️ Live Forming → 30% position (early entry)
- ⚠️ Early Warning → Add 30%
- 🔻 Confirmed → Add final 40% + move stop to breakeven
- Highest reward potential

### Strategy 3: Conservative Swing Trading
- Wait for 🔻 Confirmed signal only
- Use Live/Early as warning to prepare
- Wider stops, bigger targets

**Performance:**
- No indicator is perfect
- Always use proper risk management
- Combine with price action, S/R, and trend context
- Quality > quantity

**Best Results:**
- Divergence **at** major support/resistance = highest probability
- Live/Early + Confirmed alignment = strongest confluence
- Multiple timeframe agreement = elite setups

## 📊 What Makes This Different?

**Other indicators:**
- Use RSI/MACD/oscillators
- Lag behind real order flow
- Many false signals

**This indicator:**
- Uses **real Cumulative Volume Delta**
- Shows actual institutional buying/selling pressure
- Three-tier detection: Live → Early → Confirmed
- Minimal clutter, maximum clarity

## 🚀 Quick Start

1. Add to chart
2. Start with default 15m settings
3. Enable Live Mode for fastest signals
4. Paper trade for 1 week
5. Begin live trading small
6. Scale up as confidence grows

## 📈 Typical Performance

| Mode | Win Rate | Avg R/R | Best For |
|-------------------|----------|---------|------------------|
| Live Only | 50-60% | 1:1.5 | Ultra-fast scalping |
| Early Warning | 55-65% | 1:1.8 | Scalping |
| Confirmed | 70-80% | 1:2+ | Swing trading |
| Live + Confirmed | 65-75% | 1:3+ | Day trading |
| With S/R Confluence | 75-85% | 1:4+ | All styles |

## 💬 Tips from Pro Traders

- "Live mode gives you the jump on everyone else watching confirmed only"
- "Best trades: Live warning → Early confirmation → Confirmed trigger"
- "Skip Live signals in strong trends – wait for Early/Confirmed"
- "On 15m, Live mode often gives 1-2 hour head start"
- "Always wait for price to respect S/R before trusting any divergence"

## 🔔 Alert Setup

1. Click Alert button (⏰)
2. Select "CVD Divergence Detector"
3. Choose your alert types (recommend Live + Confirmed)
4. Set notifications
5. Done!

## ⚙️ Settings Explained

**Delta Source:**
- Anchor Timeframe: Higher TF for smoother CVD (1D default for day trading)
- Custom Lower TF: For advanced volume aggregation

**Pivot Logic:**
- Pivot Left/Right: Strength of confirmed pivots
- Early Warning Right Bars: Speed of early signals
- Enable Live Divergence: Real-time detection (current bar)
- Min Bars Between: Anti-spam filter
- Min CVD Diff %: Filters weak/insignificant divergences

**Visual:**
- Show Lines/Labels: Toggle display elements
- Live Divergence Color: Customize live signal appearance

## ❓ FAQ

**Q: No signals appearing?**
- Check symbol has volume data
- Lower Min CVD Diff to 3%
- Reduce pivot strength
- Try Live Mode

**Q: Too many signals?**
- Increase filters (see Tuning Guide)
- Disable Live Mode
- Use Confirmed only

**Q: Signals too late?**
- Enable Live Mode (fastest)
- Enable Early Warning
- Reduce Early Right Bars to 2

**Q: Works on crypto/forex?**
- Crypto perpetuals: Excellent
- Major forex pairs: Good (if broker provides volume)
- Futures/Stocks: Best performance

## 📝 Version Info

**v2.0** - Major Update
- **Added Live Divergence Mode** (real-time detection)
- Six alert types (including Live)
- Improved performance and filtering
- Enhanced visuals for all three modes

**v1.0** - Initial Release
- Confirmed + Early Warning modes
- Smart filtering and alerts

---

**Questions? Suggestions?** Drop a comment below! 👇

**Found this helpful?** Like and follow for more professional-grade indicators! ⭐
Notas de Lançamento
# CVD Divergence Detector

Clean, focused divergence detection using **Cumulative Volume Delta (CVD)** - one of the most reliable reversal signals in trading.


Bug Fix Release (January 2026)

🔧 Fixed repainting issues
🔧 Fixed alerts firing without visible signals
🔧 Fixed desynchronized pivot tracking
🔧 Resolved TradingView consistency warnings
➖ Removed "Live Divergence" feature (caused repainting)
➕ Added "Detection Window" parameter
✨ Improved signal reliability


## 🎯 What It Does

Identifies divergences between **price action** and **volume delta**:

**🔻 Bearish Divergence**: Price makes Higher High, but CVD doesn't → Expect reversal DOWN
**🔺 Bullish Divergence**: Price makes Lower Low, but CVD doesn't → Expect reversal UP

## ✨ Key Features

### Two Detection Modes

**1. Confirmed Divergences** (High Accuracy)
- Solid red/green lines
- Labels: 🔻 Bear / 🔺 Bull
- Fully confirmed pivots (9 bars default)
- Win rate: ~70-80%

**2. Early Warning Mode** ⚡ (Fast Signals)
- Dashed yellow lines
- Labels: ⚠️ Early Bear / ⚠️ Early Bull
- Fires 6+ bars earlier (3 bars default)
- Win rate: ~55-65%

### Smart Filtering
- Minimum bars between signals (prevents spam)
- Minimum CVD strength requirement (filters weak signals)
- Adjustable pivot periods for any timeframe

### Four Alert Types
- 🔻 Confirmed Bearish Divergence
- 🔺 Confirmed Bullish Divergence
- ⚠️ Early Bearish Warning
- ⚠️ Early Bullish Warning

## ⚙️ Recommended Settings

**15m Day Trading** (Best for most traders):
```
Pivot Left/Right: 9
Early Warning Right: 3
Min Bars Between: 40
Min CVD Diff: 5%
Anchor TF: 1D
```

**5m Scalping**:
```
Pivot Left/Right: 7
Early Warning Right: 2
Min Bars Between: 60
Min CVD Diff: 5%
```

**1H Swing Trading**:
```
Pivot Left/Right: 12-14
Early Warning Right: 4-5
Min Bars Between: 30
Min CVD Diff: 8%
```

## 💡 Trading Strategies

### Strategy 1: Early Entry (Scalpers)
- ⚠️ Early warning → Enter immediately
- Stop: Just beyond pivot
- Target: 1:2 R/R minimum
- Trades/day: 3-8

### Strategy 2: Scale In (Day Traders)
- ⚠️ Early warning → 25% position
- 🔻 Confirmed → Add 75%
- Move stop to breakeven
- Trades/week: 5-15

### Strategy 3: Confirmation Only (Swing Traders)
- Wait for 🔻 confirmed signal only
- Wider stops (1-2 ATR)
- Hold for bigger moves
- Trades/month: 8-20

## 🎯 How to Use

1. **Install** indicator on your chart
2. **Choose** your timeframe (15m recommended to start)
3. **Enable** Early Warning for faster signals OR disable for confirmed only
4. **Set alerts** for your preferred divergence types
5. **Combine** with support/resistance for best results

## 🔧 Tuning Guide

**Too many signals?**
- Increase Pivot Right to 12-15
- Increase Min Bars Between to 60
- Increase Min CVD Diff to 8-10%

**Signals too slow?**
- Enable Early Warning
- Decrease Early Warning Right to 2
- Decrease Pivot Right to 6-7

**Want cleaner chart?**
- Turn off labels (lines only)
- Disable early warnings (confirmed only)

## ⚠️ Important Notes

**Requirements:**
- Volume data required (works on futures, stocks, crypto)
- May not work on some forex pairs (broker-dependent)

**Performance:**
- No indicator is 100% accurate
- Always use proper risk management
- Combine with price action and S/R levels
- Quality over quantity - don't trade every signal

**Best Results:**
- Divergence AT support/resistance = high probability
- Divergence + trend reversal pattern = confluence
- Multiple timeframe confirmation = strongest signals

## 📊 What Makes This Different?

**Other divergence indicators:**
- Use RSI, MACD, or other oscillators
- Don't show actual order flow
- Often give false signals

**This indicator:**
- Uses real CVD (Cumulative Volume Delta)
- Shows actual buying/selling pressure
- Filters for quality (not quantity)
- Two modes: fast OR accurate (your choice)
- No clutter - just clean divergence lines

## 🚀 Quick Start

1. Add to chart
2. Default settings work well for 15m
3. Watch for 1 week before trading
4. Start with small size
5. Track your results

## 📈 Typical Performance

| Mode | Win Rate | Avg R/R | Best For |
|------|----------|---------|----------|
| Early Warning | 55-65% | 1:1.5 | Scalping |
| Confirmed | 70-80% | 1:2 | Swing trading |
| Both (Scale In) | 65-75% | 1:3 | Day trading |
| With Confluence | 75-85% | 1:3+ | All styles |

## 💬 Tips from Pro Traders

- "Use early warnings for entries, confirmed for validation"
- "Best at major S/R levels - skip divergences in the middle of nowhere"
- "Lower timeframes = more signals but lower quality"
- "On 15m chart, early warnings give you 1.5 hour head start"
- "Combine with volume spikes for highest probability"

## 🔔 Alert Setup

1. Click Alert button (⏰)
2. Choose "CVD Divergence Detector"
3. Select alert type
4. Configure notifications
5. Done!

## ⚙️ Settings Explained

**Delta Source:**
- Anchor Timeframe: Higher TF for CVD calculation (1D for day trading)
- Custom Lower TF: Advanced users only

**Pivot Logic:**
- Pivot Left/Right: How many bars to confirm pivot
- Early Warning Right: How fast early signals fire
- Min Bars Between: Prevents signal spam
- Min CVD Diff %: Filters weak divergences

**Visual:**
- Show Lines/Labels: Toggle display
- Colors: Customize to your preference
- Label Size: Adjust for readability

## ❓ FAQ

**Q: No signals appearing?**
- Check volume data is available
- Lower Min CVD Diff to 2-3%
- Lower Pivot Right to 5-7

**Q: Too many signals?**
- Increase filters (see Tuning Guide above)
- Turn off early warnings
- Use confirmed only

**Q: Signals too late?**
- Enable Early Warning mode
- Decrease Early Warning Right to 2-3

**Q: Works on crypto/forex?**
- Crypto: Yes (major pairs)
- Forex: Sometimes (depends on broker volume data)
- Futures/Stocks: Yes (best performance)

## 📚 Learn More

For detailed strategies, examples, and advanced techniques, check the full user guide.

---

**Remember:** This is a tool, not a crystal ball. Combine with:
- Price action analysis
- Support/resistance levels
- Risk management
- Proper position sizing

**The best trade is the one you don't force.** 🎯

---

## 📝 Version Info

**v1.0** - Initial Release
- Confirmed divergence detection
- Early warning mode
- Smart filtering system
- Four alert types
- Clean visual design

---

**Questions? Suggestions?** Drop a comment below! 👇

**Found this helpful?** Like and follow for more professional indicators! ⭐

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.