PROTECTED SOURCE SCRIPT
detecteur de volume

🎯 Main Objective
This script analyzes Open Interest (open positions) calculated simply as Volume ÷ 2 and detects significant variations to identify important market movements.
🔧 How It Works
1. Open Interest Calculation
Open Interest = Bar Volume / 2
Each trading candle has a volume
The script divides this volume by 2 to get OI
OI approximately represents open positions in the market
2. Variation Calculation
Variation % = ((Current OI - Previous OI) / Previous OI) × 100
Compares current bar's OI to the previous bar
Expresses the result as a percentage
Example: If OI goes from 1000 to 1300 → Variation = +30%
📊 Visualization Modes
The script offers 3 modes to choose from:
Mode 1: "Open Interest Brut" (Raw Open Interest)
Displays an OI curve
Green color when OI rises
Red color when OI falls
Option to add a moving average (orange) to see the trend
Mode 2: "Variation %" (RECOMMENDED)
Displays bars showing % variation
Green bars = increases
Red bars = decreases
Reference lines at +25%, -25% and 0%
Easier to read for detecting movements
Mode 3: "Les Deux" (Both)
Combines both charts
Complete view but more crowded
🚨 2-Level Alert System
Level 1: Labels - 25% Threshold
Trigger: Variation ≥ 25% or ≤ -25%
Display: Label with exact percentage
"↑ +32.5%" (green) for an increase
"↓ -28.3%" (red) for a decrease
Purpose: Signal notable movements
Level 2: Triangles - 200% Threshold
Trigger: Variation ≥ 200% or ≤ -200%
Display:
🔺 GREEN Triangle (pointing up) = Extreme increase
🔻 RED Triangle (pointing down) = Extreme decrease
Purpose: Signal exceptional and rare movements
⚙️ Adjustable Parameters
ParameterDefaultDescriptionType de Visualisation"Variation %"Choose how to display dataSeuil de Variation25%When to show labelsSeuil pour Triangles200%When to show trianglesAfficher les FlèchesYESEnable/disable labels and trianglesAfficher Moyenne MobileYESAdd a trend linePériode Moyenne Mobile20Number of bars for the average
📈 Information Table
Top right corner of the chart:
RowInformationOpen InterestCurrent OI valueVariation% change (green/red depending on direction)SignalCurrent state: "↑ HAUSSE", "↓ BAISSE" or "Normal"
🔔 TradingView Alerts
The script generates 4 types of alerts:
🟢 Hausse OI > 25% - Normal increase alert
🔴 Baisse OI > 25% - Normal decrease alert
🚨🟢 STRONG ALERT: Increase > 200% - Exceptional upward movement
🚨🔴 STRONG ALERT: Decrease > 200% - Exceptional downward movement
💡 Signal Interpretation
Variations > 25% (Labels)
Indicate increased interest in the asset
Increase: More open positions → Possible upcoming movement
Decrease: Position closures → Possible reversal
Variations > 200% (Triangles)
VERY RARE and POWERFUL signal
Indicates a major event or anomaly
May precede significant price movements
Requires immediate verification
🎨 Color Code
🟢 Green = Increase, positive, buy
🔴 Red = Decrease, negative, sell
🟠 Orange = Moving average (trend)
🟣 Purple = Variation % line
⚪ Gray = 0% reference line
📌 Use Cases
For Day Trading
"Variation %" mode on 5min or 15min timeframe
Detect volume/OI spikes in real-time
Triangles = Exceptional opportunities
For Swing Trading
"Open Interest Brut" mode with moving average
1H or 4H timeframe
Follow the general OI trend
For Screening
Use alerts on multiple assets
Triangles signal "hot" assets
Labels to monitor general activity
⚠️ Limitations
OI = Volume/2 is an approximation
Real Open Interest requires specific data (futures/options)
This formula works but remains an estimate
No real OI history
Only calculates on available volume
Doesn't account for accumulated OI from previous days
Sensitivity to gaps
A volume gap can create false signals
Should be used with other indicators
✅ Strengths
✅ Simple and effective
✅ Works on all markets (stocks, crypto, forex, futures)
✅ Automatic detection of abnormal movements
✅ Configurable alerts
✅ Clear and intuitive visual
✅ Lightweight and fast (no complex calculations)
🎓 Usage Tips
Start with "Variation %" mode - More readable
Adjust thresholds to your style - 25% may be too sensitive on some assets
Combine with price analysis - OI alone isn't enough
Watch the triangles - These are the most important signals
Create alerts - To catch everything even off-screen
🔍 Technical Breakdown
Core Components:
1. Data Collection
Pulls volume data from each bar
Calculates OI as volume divided by 2
Stores previous bar's OI for comparison
2. Mathematical Processing
Computes percentage change between bars
Applies smoothing with optional moving average
Identifies threshold crossings (25% and 200%)
3. Visual Output
Plots OI curve or variation bars
Conditionally displays based on selected mode
Uses dynamic coloring (green/red) based on direction
4. Signal Generation
Boolean logic for threshold detection
Separate signals for labels and triangles
Triggers alerts when conditions are met
📊 Advanced Features
Multi-Mode Display
The script uses conditional plotting with na (not available) values to show/hide elements:
When "OI Brut" is selected → variation plot receives na
When "Variation %" is selected → OI plot receives na
When "Les Deux" is selected → both plots display
Dynamic Coloring
Colors update in real-time based on:
Current vs. previous bar comparison
Positive variations → green spectrum
Negative variations → red spectrum
Smart Labeling
Labels position automatically:
Above bar for decreases (yloc.abovebar)
Below bar for increases (yloc.belowbar)
Adapts to selected visualization mode
🎯 Best Practices
For Optimal Performance:
Timeframe Selection
Lower timeframes (1m-15m): More signals, more noise
Higher timeframes (1H-1D): Fewer but more reliable signals
Threshold Adjustment
Volatile assets: Increase thresholds (30%/250%)
Stable assets: Decrease thresholds (20%/150%)
Test different values to find your sweet spot
Combining Indicators
Use with volume profile
Pair with RSI for confirmation
Check price action before acting on signals
Alert Management
Set alerts only for triangles on multiple assets
Use label alerts for assets you actively monitor
Avoid alert fatigue by being selective
🚀 Performance Notes
Lightweight: Minimal CPU usage
Fast execution: Simple calculations only
Real-time updates: Instant signal detection
Low latency: No API calls or external data
Universal compatibility: Works on all TradingView plans
There you go! You now have a powerful tool to detect abnormal Open Interest movements. The two-level system (25% and 200%) allows you to filter noise and focus on what really matters. 🚀
This script analyzes Open Interest (open positions) calculated simply as Volume ÷ 2 and detects significant variations to identify important market movements.
🔧 How It Works
1. Open Interest Calculation
Open Interest = Bar Volume / 2
Each trading candle has a volume
The script divides this volume by 2 to get OI
OI approximately represents open positions in the market
2. Variation Calculation
Variation % = ((Current OI - Previous OI) / Previous OI) × 100
Compares current bar's OI to the previous bar
Expresses the result as a percentage
Example: If OI goes from 1000 to 1300 → Variation = +30%
📊 Visualization Modes
The script offers 3 modes to choose from:
Mode 1: "Open Interest Brut" (Raw Open Interest)
Displays an OI curve
Green color when OI rises
Red color when OI falls
Option to add a moving average (orange) to see the trend
Mode 2: "Variation %" (RECOMMENDED)
Displays bars showing % variation
Green bars = increases
Red bars = decreases
Reference lines at +25%, -25% and 0%
Easier to read for detecting movements
Mode 3: "Les Deux" (Both)
Combines both charts
Complete view but more crowded
🚨 2-Level Alert System
Level 1: Labels - 25% Threshold
Trigger: Variation ≥ 25% or ≤ -25%
Display: Label with exact percentage
"↑ +32.5%" (green) for an increase
"↓ -28.3%" (red) for a decrease
Purpose: Signal notable movements
Level 2: Triangles - 200% Threshold
Trigger: Variation ≥ 200% or ≤ -200%
Display:
🔺 GREEN Triangle (pointing up) = Extreme increase
🔻 RED Triangle (pointing down) = Extreme decrease
Purpose: Signal exceptional and rare movements
⚙️ Adjustable Parameters
ParameterDefaultDescriptionType de Visualisation"Variation %"Choose how to display dataSeuil de Variation25%When to show labelsSeuil pour Triangles200%When to show trianglesAfficher les FlèchesYESEnable/disable labels and trianglesAfficher Moyenne MobileYESAdd a trend linePériode Moyenne Mobile20Number of bars for the average
📈 Information Table
Top right corner of the chart:
RowInformationOpen InterestCurrent OI valueVariation% change (green/red depending on direction)SignalCurrent state: "↑ HAUSSE", "↓ BAISSE" or "Normal"
🔔 TradingView Alerts
The script generates 4 types of alerts:
🟢 Hausse OI > 25% - Normal increase alert
🔴 Baisse OI > 25% - Normal decrease alert
🚨🟢 STRONG ALERT: Increase > 200% - Exceptional upward movement
🚨🔴 STRONG ALERT: Decrease > 200% - Exceptional downward movement
💡 Signal Interpretation
Variations > 25% (Labels)
Indicate increased interest in the asset
Increase: More open positions → Possible upcoming movement
Decrease: Position closures → Possible reversal
Variations > 200% (Triangles)
VERY RARE and POWERFUL signal
Indicates a major event or anomaly
May precede significant price movements
Requires immediate verification
🎨 Color Code
🟢 Green = Increase, positive, buy
🔴 Red = Decrease, negative, sell
🟠 Orange = Moving average (trend)
🟣 Purple = Variation % line
⚪ Gray = 0% reference line
📌 Use Cases
For Day Trading
"Variation %" mode on 5min or 15min timeframe
Detect volume/OI spikes in real-time
Triangles = Exceptional opportunities
For Swing Trading
"Open Interest Brut" mode with moving average
1H or 4H timeframe
Follow the general OI trend
For Screening
Use alerts on multiple assets
Triangles signal "hot" assets
Labels to monitor general activity
⚠️ Limitations
OI = Volume/2 is an approximation
Real Open Interest requires specific data (futures/options)
This formula works but remains an estimate
No real OI history
Only calculates on available volume
Doesn't account for accumulated OI from previous days
Sensitivity to gaps
A volume gap can create false signals
Should be used with other indicators
✅ Strengths
✅ Simple and effective
✅ Works on all markets (stocks, crypto, forex, futures)
✅ Automatic detection of abnormal movements
✅ Configurable alerts
✅ Clear and intuitive visual
✅ Lightweight and fast (no complex calculations)
🎓 Usage Tips
Start with "Variation %" mode - More readable
Adjust thresholds to your style - 25% may be too sensitive on some assets
Combine with price analysis - OI alone isn't enough
Watch the triangles - These are the most important signals
Create alerts - To catch everything even off-screen
🔍 Technical Breakdown
Core Components:
1. Data Collection
Pulls volume data from each bar
Calculates OI as volume divided by 2
Stores previous bar's OI for comparison
2. Mathematical Processing
Computes percentage change between bars
Applies smoothing with optional moving average
Identifies threshold crossings (25% and 200%)
3. Visual Output
Plots OI curve or variation bars
Conditionally displays based on selected mode
Uses dynamic coloring (green/red) based on direction
4. Signal Generation
Boolean logic for threshold detection
Separate signals for labels and triangles
Triggers alerts when conditions are met
📊 Advanced Features
Multi-Mode Display
The script uses conditional plotting with na (not available) values to show/hide elements:
When "OI Brut" is selected → variation plot receives na
When "Variation %" is selected → OI plot receives na
When "Les Deux" is selected → both plots display
Dynamic Coloring
Colors update in real-time based on:
Current vs. previous bar comparison
Positive variations → green spectrum
Negative variations → red spectrum
Smart Labeling
Labels position automatically:
Above bar for decreases (yloc.abovebar)
Below bar for increases (yloc.belowbar)
Adapts to selected visualization mode
🎯 Best Practices
For Optimal Performance:
Timeframe Selection
Lower timeframes (1m-15m): More signals, more noise
Higher timeframes (1H-1D): Fewer but more reliable signals
Threshold Adjustment
Volatile assets: Increase thresholds (30%/250%)
Stable assets: Decrease thresholds (20%/150%)
Test different values to find your sweet spot
Combining Indicators
Use with volume profile
Pair with RSI for confirmation
Check price action before acting on signals
Alert Management
Set alerts only for triangles on multiple assets
Use label alerts for assets you actively monitor
Avoid alert fatigue by being selective
🚀 Performance Notes
Lightweight: Minimal CPU usage
Fast execution: Simple calculations only
Real-time updates: Instant signal detection
Low latency: No API calls or external data
Universal compatibility: Works on all TradingView plans
There you go! You now have a powerful tool to detect abnormal Open Interest movements. The two-level system (25% and 200%) allows you to filter noise and focus on what really matters. 🚀
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.