OPEN-SOURCE SCRIPT

Ranked Exchange Volume (REV)

830
📊 Ranked Exchange Volume (REV) - Multi-Venue Volume Distribution Visualizer

## Stop Guessing Where the Real Volume Is. See It.

Most traders look at aggregate volume and miss the critical story: **where** that volume actually traded. Ranked Exchange Volume (REV) solves this by revealing the complete liquidity landscape across multiple trading venues in a single, elegant visualization.

This isn't just another volume indicator—it's a **dynamic stratified histogram** that automatically reorganizes exchange layers by magnitude on every bar, showing you **instant market dominance** at a glance.

---

## 🎯 The Core Innovation: Self-Organizing Volume Layers

REV displays volume from up to 10 different exchanges as **stacked, color-coded bars** where the largest volume source literally rises to the top. Watch as exchanges compete for dominance in real-time:

- **Largest volume = Top of the bar** (most visible position)
- **Smallest volume = Bottom of the bar** (foundation layer)
- **Everything in between = Automatically sorted on every candle**

This visual hierarchy makes it instantly obvious which venues are leading the market—no mental math required.

---

## ✨ Key Features

### 🔄 **Dynamic Layer Sorting**
Unlike static stacked charts, REV uses real-time stratification. If Binance had 60% of volume last bar but Coinbase takes 70% this bar, you'll see Coinbase jump to the top. The hierarchy reflects current reality, not a fixed order.

### 🎨 **10 Fully Customizable Exchange Slots**
Each exchange slot offers complete control:
- **Enable/Disable toggle** - Turn exchanges on/off without losing your configuration
- **Custom prefix** - Track ANY exchange on TradingView (BINANCE, KRAKEN, OANDA, FXCM, etc.)
- **Custom suffix** - Specify quote currency (USDT, USD, EUR, or leave blank for stocks/forex)
- **Display name** - Control how exchanges appear in the rankings table
- **Color selection** - Match your chart theme or use brand colors for instant recognition

### 📊 **Live Rankings Table**
A real-time leaderboard shows:
- **Rank** - Current position (1 = highest volume)
- **Exchange name** - With color-coded background
- **Volume** - Intelligently formatted with K/M/B units
- **Percentage** - Exact market share

**Table positioning:** Choose from 9 screen positions (top/middle/bottom × left/center/right) to keep your chart clean.

### 🧮 **Intelligent Volume Formatting**
REV automatically detects volume magnitude and applies the appropriate scale:
- **Billions** - Displays as "1.5B" for readability
- **Millions** - Displays as "342.8M"
- **Thousands** - Displays as "45.2K"
- **Full numbers option** - Toggle to see complete values (23,456,789)

The scale adjusts per-bar, so you always see the clearest representation.

### 🚨 **Three Built-In Alert Conditions**

1. **Exchange Dominance Alert (>50%)**
- Triggers when a single venue controls majority of volume
- Signals potential liquidity concentration risk or exchange-specific events

2. **Volume Spike Alert (>2x average)**
- Detects unusual aggregate activity across all venues
- Catches breakouts, news events, or institutional flow

3. **Liquidity Migration Alert**
- Fires when market leadership shifts between exchanges
- Reveals arbitrage opportunities or changing market structure

### 📈 **Optional Total Volume Line**
Display aggregate volume from all exchanges as a reference overlay with customizable color.

---

## 🌍 Market Compatibility: Beyond Crypto

While optimized for cryptocurrency (its primary design), REV works across multiple asset classes:

### ✅ **Cryptocurrency (Perfect Fit)**
**Why it excels:** Crypto trades 24/7 across dozens of global exchanges simultaneously. REV reveals true price discovery.

**Example configurations:**
- **BTC/USDT:** Compare Binance, Coinbase, OKX, Bybit, Kraken, Bitget
- **ETH/USD:** Track institutional venues (Coinbase, Kraken, Gemini) vs retail (Binance, Gate.io)
- **Altcoins:** Identify which exchanges have the deepest liquidity before placing large orders

**Trading applications:**
- **Arbitrage detection** - Spot when volume migrates between venues (price differential opportunities)
- **Exchange risk** - Don't trade on exchanges with suspiciously low volume
- **Whale tracking** - Sudden Coinbase dominance often signals institutional activity
- **Market maker identification** - Consistent Binance leadership suggests MM concentration

### ✅ **Forex (Excellent Fit)**
**Why it works:** Forex doesn't have centralized exchanges—it trades OTC across multiple broker feeds. REV shows which data providers are seeing the action.

**Example configurations:**
- **EUR/USD:** Compare OANDA, FXCM, FOREX.COM, FX_IDC, CAPITALCOM
- **GBP/JPY:** Track volatility across broker feeds
- **Exotics:** Verify liquidity before trading thin pairs

**Setup notes:**
- Leave **suffix field blank** for forex
- Use broker prefixes: OANDA, FXCM, FOREXCOM, FX_IDC, SAXO
- Symbol constructs as "OANDA:EURUSD"

**Trading applications:**
- **Spread verification** - Higher volume feeds typically offer tighter spreads
- **News event tracking** - See which brokers capture the most flow during announcements
- **Session analysis** - Watch London/NY volume shifts across different providers

### ⚠️ **Stocks (Limited But Useful)**
**Where it works:**
- **Dual-listed stocks** - Canadian companies on TSX and NYSE
- **International ADRs** - Same company, different exchanges
- **ETF arbitrage** - Compare volume across regional listings

**Example configurations:**
- **Shopify (SHOP):** Compare TSX vs NYSE volume
- **Alibaba (BABA):** NYSE vs HKEX volume
- **European stocks:** Compare primary exchange vs secondary listings

**Setup notes:**
- Leave **suffix field blank**
- Use exchange prefixes: NYSE, NASDAQ, TSX, LSE, XETRA
- Note: TradingView doesn't show per-venue volume for U.S. equities (NYSE vs BATS vs ARCA all aggregate)

**Limitations:** Most stocks trade primarily on one exchange, so REV is less valuable than in crypto/forex.

### ❌ **Futures (Not Recommended)**
Futures contracts differ by exchange (CME's ES ≠ EUREX's FESX), so volume isn't comparable.

---

## 📚 Practical Use Cases

### 1. **Pre-Trade Liquidity Analysis**
Before entering a large position, check which exchanges have sufficient volume to fill your order without slippage.

**Example:** You want to sell 50 BTC. REV shows Binance has 2,340 BTC volume this hour while a smaller exchange has only 87 BTC. Route your order to Binance for better execution.

### 2. **Exchange Risk Management**
Identify "fake volume" or wash trading by comparing venues.

**Red flag pattern:** An exchange consistently shows 10x the volume of competitors but with minimal price impact—likely artificial.

### 3. **Arbitrage Opportunity Detection**
When volume suddenly concentrates on one exchange, price premiums/discounts often appear.

**Alert pattern:** Liquidity Migration alert fires → Check price differences → Execute arb if spread exceeds fees.

### 4. **Institutional Flow Tracking**
In crypto, institutions typically use regulated exchanges (Coinbase, Kraken, Gemini).

**Pattern to watch:** Coinbase volume spikes to 60%+ dominance → Often precedes directional moves as institutions position.

### 5. **Market Structure Analysis**
Watch long-term trends in exchange dominance to understand market evolution.

**Example insight:** "Binance's market share has dropped from 70% to 45% over 6 months as traders diversify to OKX and Bybit."

### 6. **Event Response Comparison**
During major news events, see which exchanges react first.

**Analysis:** If one exchange shows volume spike 5 minutes before others, that feed may have faster news incorporation.

---

## ⚙️ Technical Specifications

- **Maximum exchanges:** 10 simultaneous venues
- **Sorting algorithm:** Bubble sort (O(n²) but optimal for n=10, prioritizes stability)
- **Update frequency:** Real-time, every bar
- **Data handling:** Gracefully ignores invalid symbols, treats NA as zero
- **Chart type:** Non-overlay (separate pane below price)
- **Performance:** Lightweight, no lag on any timeframe

---

## 🚀 Getting Started

### Quick Setup (5 Minutes)

**For Crypto Traders (Default Configuration):**
1. Add indicator to any crypto chart (BTC, ETH, SOL, etc.)
2. Works immediately—top 10 exchanges pre-configured
3. Customize colors if desired
4. Position table to your preference

**For Forex Traders:**
1. Open any forex pair (EUR/USD, GBP/JPY, etc.)
2. Go to Exchange 1 settings
3. Change prefix to "OANDA" (or your preferred broker)
4. **Clear the suffix field** (leave it blank)
5. Repeat for other exchanges (FXCM, FOREXCOM, FX_IDC, etc.)
6. Disable any unused exchange slots

**For Stock Traders (Dual-Listed):**
1. Open a dual-listed stock (e.g., SHOP on TSX)
2. Exchange 1: Prefix = "TSX", Suffix = blank, Name = "Toronto"
3. Exchange 2: Prefix = "NYSE", Suffix = blank, Name = "New York"
4. Disable exchanges 3-10
5. Compare volume distribution

### Advanced Customization

**Tracking Regional Markets:**
Want to compare Korean vs Japanese crypto exchanges?
- Exchange 1: UPBIT (Korean)
- Exchange 2: BITHUMB (Korean)
- Exchange 3: BITFLYER (Japanese)
- Exchange 4: COINCHECK (Japanese)

**Isolating Institutional Volume:**
Focus only on regulated U.S. exchanges:
- Enable: Coinbase, Kraken, Gemini
- Disable: All others
- Watch for >50% dominance alerts

---

## 👥 Who Is This For?

### ✅ **Perfect for:**
- **Crypto day traders** - Need to know where liquidity actually is
- **Arbitrage traders** - Spot cross-exchange inefficiencies
- **Institutional traders** - Validate execution venues before large orders
- **Forex scalpers** - Compare broker feeds for best execution
- **Market structure analysts** - Track long-term exchange dominance trends

### ❌ **Less useful for:**
- **Long-term investors** who don't care about short-term liquidity
- **Single-exchange traders** who never compare venues
- **Futures traders** (contracts differ by exchange)

---

## 🎓 Understanding the Visualization

**What each colored segment means:**
Each horizontal stripe represents one exchange's volume contribution. The **height** of each stripe shows that exchange's volume relative to others.

**Reading the pattern:**
- **Dominant top layer** (50%+ of bar) = Clear market leader
- **Evenly distributed layers** (10-15% each) = Fragmented liquidity
- **Sudden layer reorganization** = Liquidity migration event
- **Shrinking bottom layers** = Exchanges losing market share

**Color coding strategy:**
The indicator defaults to exchange brand colors for instant recognition:
- Yellow = Binance (their signature gold)
- Blue = Coinbase (their brand blue)
- Purple = Kraken (their brand purple)
- etc.

You can customize all colors to match your chart theme.

---

## 🔧 Configuration Tips

### **Best Practices:**

1. **Start with defaults** - Test on BTC/USDT to understand behavior
2. **Disable unused exchanges** - Cleaner visualization, faster computation
3. **Match your trading venues** - Only track exchanges you actually use
4. **Use brand colors initially** - Helps build visual pattern recognition
5. **Enable alerts strategically** - Don't spam yourself; focus on actionable signals

### **Common Mistakes to Avoid:**

❌ Tracking too many irrelevant exchanges (creates visual noise)
❌ Forgetting to clear suffix for forex/stocks (symbol won't construct properly)
❌ Using the same color for multiple exchanges (defeats instant recognition)
❌ Hiding the table permanently (you lose the percentage data)

---

## 📊 Performance Notes

- **Lightweight computation** - No impact on chart performance
- **Works on all timeframes** - 1-minute to monthly
- **Historical analysis** - Full bar history available (max_bars_back=5000)
- **Multi-monitor friendly** - Table positioning adapts to any screen layout

---

## 🆕 Future Enhancements (Planned)

While the current version is feature-complete, potential additions include:
- Volume-weighted average price (VWAP) overlay per exchange
- Historical dominance charts (which exchange led most this week/month)
- Correlation matrix (do exchanges move together or independently?)

**User feedback shapes development** - Comment with your requests!

---

## 💡 Pro Tips

### **Tip 1: The "Whale Exchange" Filter**
In crypto, institutions use Coinbase/Kraken. Enable ONLY these two exchanges to isolate professional flow and ignore retail noise.

### **Tip 2: The "Arbitrage Scanner"**
Set Liquidity Migration alert on 1-minute timeframe. When it fires, check price across exchanges—often there's a temporary premium/discount.

### **Tip 3: The "Liquidity Gauge"**
Before placing a large market order, switch to 5-minute timeframe and check last 10 bars. If your target exchange consistently has <20% of volume, you'll face slippage.

### **Tip 4: The "Market Structure Tracker"**
Take screenshots of the table weekly. Over time, you'll see exchange market share trends that reveal fundamental shifts in trader preferences.

### **Tip 5: The "News Event Validator"**
During major announcements (Fed decisions, earnings, etc.), watch which exchange shows volume first. That's where informed traders are positioned.

---

## 🎯 Summary

**Ranked Exchange Volume (REV) transforms volume analysis from a single number into a complete market microstructure view.**

Instead of seeing "1.2M volume," you see:
- Binance: 640K (53%)
- Coinbase: 280K (23%)
- OKX: 180K (15%)
- Bybit: 100K (9%)

**That's actionable intelligence.**

Whether you're executing a large crypto trade, arbitraging forex across brokers, or validating liquidity before buying a dual-listed stock, REV shows you **where the market actually is**—not where you assume it is.

---

## 📖 Quick Reference Card

| Feature | What It Does | Why It Matters |
|---------|-------------|----------------|
| **Dynamic Sorting** | Largest volume rises to top | Instant dominance identification |
| **10 Custom Slots** | Track any exchanges | Works for YOUR trading venues |
| **Live Rankings** | Real-time leaderboard | Precise market share data |
| **Smart Formatting** | Auto K/M/B scaling | Always readable, never cluttered |
| **Dominance Alert** | Warns at >50% concentration | Risk management for large orders |
| **Migration Alert** | Fires on leadership change | Arbitrage opportunity signal |
| **Spike Alert** | Detects 2x volume surges | Breakout/news confirmation |
| **Total Line** | Shows aggregate volume | Reference for overall activity |
| **Table Positioning** | 9 screen locations | Adapts to your layout |
| **Full/Short Toggle** | Complete vs abbreviated numbers | Flexibility for different assets |

---

## ✅ Installation & Support

**Install:** Add to your TradingView favorites, apply to any chart
**Updates:** Automatic through TradingView
**Support:** Comment with questions—active developer community

**Like this indicator?** Leave a ⭐ rating and share with fellow traders who need better volume intelligence.

---

**🚀 Start seeing the complete volume picture. Add Ranked Exchange Volume to your charts today.**

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.