Swing Structure Bands [ChartPrime]⯁ OVERVIEW
Swing Structure Bands is a structure-based trend and reaction indicator that builds adaptive price bands directly from swing highs and swing lows.
Instead of using fixed-length moving averages, the bands dynamically adjust their length based on how long price has been forming higher highs or lower lows, allowing the indicator to naturally align with real market structure.
This makes the tool especially effective for identifying swing-based support and resistance, trend continuation zones, and exhaustion reactions.
⯁ CORE CONCEPT
The indicator continuously tracks:
The most recent swing high and swing low over a configurable swing window.
How long price has been developing since each swing point.
Dynamic moving averages whose length grows with the swing itself.
As long as price respects the current swing direction, the bands extend and adapt.
When structure breaks, the system resets and starts forming new swing-based bands.
⯁ SWING DETECTION LOGIC
A Swing High is detected when price forms a local maximum relative to the swing lookback.
A Swing Low is detected when price forms a local minimum relative to the swing lookback.
Direction flips when price transitions from forming highs to forming lows, or vice versa.
Each confirmed swing is marked on the chart, giving clear structural context.
⯁ ADAPTIVE BAND CONSTRUCTION
Upper bands are derived from swing highs.
Lower bands are derived from swing lows.
Band length dynamically increases as the swing develops.
Multiple MA types can be used (SMA, EMA, SMMA/RMA, WMA, VWMA).
ATR is applied as an offset to create upper and lower envelopes around each band, forming a volatility-aware structure channel.
⯁ VOLATILITY FILTERING
If the band moves too aggressively relative to ATR, it is temporarily disabled.
This prevents unstable or noisy bands during sudden expansions.
Bands only remain active when price structure is stable.
This logic keeps the indicator focused on meaningful swings rather than short-term spikes.
⯁ REACTION & SIGNAL LOGIC
Sell signals appear when price crosses down from the upper swing band after sufficient stabilization.
Buy signals appear when price crosses up from the lower swing band after sufficient stabilization.
Cooldown logic prevents signal clustering.
Signals are designed as structure reactions , not momentum breakouts.
⯁ VISUAL STRUCTURE CLARITY
Separate bullish and bearish bands with customizable colors.
Optional band envelopes for visual depth.
Clear swing labels marking structural turning points.
Diamond markers highlight reaction zones.
The visualization emphasizes where price reacts to structure rather than where it accelerates.
⯁ HOW TO USE
Use upper bands as dynamic resistance during bearish or corrective phases.
Use lower bands as dynamic support during bullish phases.
Combine band reactions with higher-timeframe trend direction.
Look for confirmations near bands rather than mid-range entries.
The indicator works best as a structure framework rather than a standalone signal generator.
⯁ IDEAL MARKET CONDITIONS
Trending markets with clear swing development.
Markets transitioning from impulse to correction.
Crypto, forex, indices, and liquid stocks.
⯁ CONCLUSION
Swing Structure Bands offers a structurally grounded alternative to traditional moving average channels.
By anchoring bands to real swing behavior and adapting dynamically over time, it provides traders with a clearer view of where price is reacting, pausing, or potentially reversing within the broader market structure.
インジケーターとストラテジー
BuyLow SellHigh Bands | ProjectSyndicate________________________________________
📊 BuyLow SellHigh (BLSH) Bands
Comprehensive Trading Guide – by ProjectSyndicate
________________________________________
🔰 1. Introduction
The BuyLow SellHigh (BLSH) Bands indicator is a powerful technical analysis tool designed for the TradingView platform. Works with any symbol. Gold/FX/indices/oil/crypto/stocks.
It provides traders with a clear, visual representation of:
• 📈 Overbought conditions
• 📉 Oversold conditions
This makes it easier to identify high-probability entry and exit points.
The indicator is built on:
• Dynamic price channels
• Fibonacci-based zones
• Color-coded market structure
💡 While the BLSH Bands can be used on Forex, Crypto, and Futures, this guide focuses on Gold (XAUUSD) using:
• M5
• M15
• M30 timeframes
________________________________________
🧠 2. Core Concepts
The BLSH Bands structure is created using two key components:
________________________________________
📐 Dynamic Price Bands
• Upper and lower bands are calculated using the highest high and lowest low
• Based on a user-defined lookback period (fiboPeriod)
• Reflects recent volatility and price range
This creates a self-adjusting channel that adapts to market conditions.
________________________________________
🧮 Fibonacci Zones
The space between the bands is divided into six Fibonacci-based zones:
• 0.786
• 0.618
• 0.500
• 0.382
• 0.214
⚠️ These are not traditional retracements — they are used to grade price extremity within the channel.
________________________________________
🎨 Color-Coded Zones Overview
Zone (Fib Level) Color Market Condition Interpretation
1.000 – 0.786 🔴 Red Extreme Overbought High reversal / pullback probability
0.786 – 0.618 🟠 Orange Overbought Selling pressure building
0.618 – 0.500 🟡 Yellow Mildly Overbought Bullish momentum weakening
0.500 – 0.382 🟢 Aqua Mildly Oversold Bearish momentum weakening
0.382 – 0.214 🔵 Deep Sky Blue Oversold Strong buying interest
0.214 – 0.000 🔷 Blue Extreme Oversold High bounce / reversal probability
🖤 Solid black separator lines ensure clean visual separation between zones for precise price location.
________________________________________
🪙 3. Trading Strategies for XAUUSD (Gold)
Gold’s volatility and respect for technical levels make it ideal for BLSH Bands strategies.
________________________________________
⚡ M5 Timeframe – Scalping Strategy
Designed for fast mean-reversion trades from extreme zones.
🟢 BUY Setup
• Price enters Extreme Oversold (Blue) zone
• Bullish confirmation candle appears:
o Hammer
o Bullish engulfing
• Enter BUY
🔴 SELL Setup
• Price enters Extreme Overbought (Red) zone
• Bearish confirmation candle appears:
o Shooting star
o Bearish engulfing
• Enter SELL
🎯 Take Profit:
• Median band (between Yellow & Aqua)
🛑 Stop Loss:
• Just outside the outer band
________________________________________
📆 M15 Timeframe – Day Trading Strategy
Balanced timeframe for higher-probability reversals.
🟢 BUY Setup
• Price enters Oversold (Blue / Deep Sky Blue)
• Strong bullish reversal candle closes back inside bands
• Enter BUY after close
🔴 SELL Setup
• Price enters Overbought (Red / Orange)
• Bearish reversal candle closes back inside bands
• Enter SELL after close
🎯 Take Profit (Multi-Target):
1. Median band
2. Opposite extreme band
🛑 Stop Loss:
• Beyond high/low of confirmation candle
________________________________________
🔄 M30 Timeframe – Swing Trading Strategy
Used for identifying major swing points.
🔍 Trend Filter
• Use 100 or 200 EMA
• Trade only in trend direction
🟢 Uptrend
• Buy pullbacks into Oversold zones
🔴 Downtrend
• Sell rallies into Overbought zones
📉 Confirmation:
• Band rejection
• RSI or MACD divergence
🎯 Take Profit:
• Previous structure levels
• Opposite band extreme
🛑 Stop Loss:
• Below / above recent swing high or low
________________________________________
🚨 4. Alerts System
Alerts are disabled by default to keep charts clean.
✅ How to Enable
• Open indicator settings
• Check “Enable Alerts”
________________________________________
🔔 Available Alerts
🔴 Overbought Alert
• Trigger: Price crosses above 0.786
• Message:
🔴 SELL SIGNAL: Price entered Overbought Zone – Consider selling or taking profits
🟢 Oversold Alert
• Trigger: Price crosses below 0.214
• Message:
🟢 BUY SIGNAL: Price entered Oversold Zone – Consider buying or entering long
________________________________________
⏱ Alert Spacing Logic
• Default: 20/50 bars
• Prevents repeated alerts in choppy markets
• Filters for higher-quality signals
________________________________________
⚙️ 5. Customization Settings
Adjust the indicator in the Settings panel:
🔧 Core Inputs
• fiboPeriod → Band sensitivity
• extremes → Price source (High/Low or Close)
🔔 Alert Controls
• Enable / disable alerts
• Separate control for overbought & oversold
• Alert spacing (bars)
________________________________________
⭐ How You Can Support ProjectSyndicate (3 Steps)
1. ✅ Click “Add to Favorites” to save this script to your TradingView Favorites
2. 🔎 Check out our other scripts to complete your SMC toolkit
3. 👤 Follow ProjectSyndicate for the latest updates, upgrades, and new releases
________________________________________
⚠️ 6. Disclaimer
Trading involves significant risk and may not be suitable for all traders.
This indicator is a decision-support tool, not a standalone trading system.
Always apply:
• Proper risk management
• Additional confirmations
• Sound trading discipline
📉 Past performance does not guarantee future results.
Gamma of Gamma - AnticipationGamma of Gamma — Anticipation Engine
What if you could detect market inflections before they become obvious? Not react to momentum — anticipate the momentum itself.
"Gamma here refers to mathematical acceleration (2nd derivative), NOT options Gamma"
Gamma of Gamma (GoG) operates one abstraction layer above conventional indicators. While RSI tells you what momentum did , GoG tells you what momentum is about to do . This is the difference between chasing price and positioning ahead of it.
Core Innovation: Traditional indicators measure first-order effects (price change) or second-order effects (momentum/acceleration). This system measures the third derivative — the rate of change of acceleration itself. When Gamma-of-Gamma reaches extremes, it signals that pressure dynamics are about to flip — often 2-5 bars before price visibly reacts.
Target Users: Discretionary traders, scalpers, and swing traders who want early positioning signals with statistical rigor. Effective on stocks, crypto, forex, and futures with meaningful volume data.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHY THIRD-DERIVATIVE ANALYSIS?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Hierarchy of Market Information
Most traders operate at the wrong level of abstraction:
• Price → What happened (lagging)
• Momentum → How fast it happened (still lagging)
• Gamma (2nd Derivative) → How momentum is changing (coincident)
• Gamma of Gamma (3rd Derivative) → How FAST that change is changing ( leading )
The third derivative captures inflection acceleration — the mathematical signature of regime transition. When GoG reaches extreme values, the market is telegraphing that current pressure dynamics are unsustainable.
Why This Beats RSI
RSI measures momentum magnitude. GoG measures momentum trajectory .
Consider this scenario: RSI reads 70 (overbought). Is the move exhausted or just getting started? RSI cannot tell you. GoG can — because it measures whether buying pressure is accelerating into the high RSI reading (continuation likely) or decelerating despite high RSI (reversal imminent).
RSI answers: "How strong was the move?"
GoG answers: "Is the move strengthening or weakening right now ?"
The first is historical. The second is predictive.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MATHEMATICAL FOUNDATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Layer 1: Cumulative Volume Delta (CVD)
The foundation is order flow approximation:
• Up bar (close > prior close): Volume classified as buying pressure
• Down bar (close < prior close): Volume classified as selling pressure
• CVD = Running sum of signed volume
Interpretation: Rising CVD indicates net aggressive buying. Falling CVD indicates net aggressive selling. CVD divergence from price often precedes reversals.
Layer 2: Gamma (Second Derivative)
Gamma measures acceleration of order flow:
Formula: Gamma = CVD - 2×CVD + CVD
This is the discrete second derivative — the rate of change of the rate of change. When Gamma spikes positive, buying pressure is accelerating . When Gamma spikes negative, selling pressure is accelerating.
Layer 3: Gamma of Gamma (Third Derivative)
GoG measures jerk — the acceleration of acceleration:
Formula: GoG = Gamma - 2×Gamma + Gamma
Critical insight: Extreme GoG readings indicate that current pressure dynamics are reaching an inflection point. The system is "overextended" in its current trajectory and will likely revert or reverse.
Layer 4: Z-Score Normalization
Raw GoG values are normalized against their 50-period distribution:
Formula: GoG_Z = (GoG - Mean_50) / StdDev_50
Benefit: Z-scores are regime-adaptive. A "2.0" reading always means "2 standard deviations from normal" regardless of whether you're trading a penny stock or ES futures. This makes thresholds consistent across instruments and timeframes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SIGNAL GENERATION LOGIC
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Long Signal (Bullish Anticipation)
Triggers when:
• GoG Z-score < -Threshold (default -2.0)
• Volume > Average Volume × Minimum Multiple (default 1.2×)
Interpretation: Selling pressure acceleration has reached an extreme negative reading. The selling is "exhausting itself" — acceleration is peaking and will soon decelerate. Buyers are likely to step in.
Short Signal (Bearish Anticipation)
Triggers when:
• GoG Z-score > +Threshold (default +2.0)
• Volume > Average Volume × Minimum Multiple (default 1.2×)
Interpretation: Buying pressure acceleration has reached an extreme positive reading. The buying is "exhausting itself" — often occurs at blow-off tops, failed breakouts, or momentum climaxes.
Why Volume Confirmation?
Gamma acceleration in thin liquidity is meaningless noise. The volume filter ensures signals occur only when meaningful participation backs the pressure dynamics. This dramatically reduces false signals during low-activity periods.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CONFIDENCE ENGINE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Not all signals are equal. The Confidence Engine quantifies signal strength:
Confidence Calculation:
Confidence = 50 + ((|Z-Score| - Threshold) / Threshold) × 100
Capped at 100%
Visual Representation:
• Small orb = Low confidence (50-65%)
• Normal orb = Medium confidence (65-80%)
• Large orb = High confidence (80-100%)
Orb transparency also adjusts — high-confidence signals appear brighter and more prominent. This creates intuitive visual hierarchy where stronger signals demand more attention.
Practical Use:
• High confidence (>80%): Consider larger position size, tighter stops
• Medium confidence (50-80%): Standard position size
• Low confidence (<50%): Reduced size or wait for confirmation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INTEGRATED BACKTESTER
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Every signal system needs accountability. The onboard backtester provides real-time performance tracking:
Core Metrics:
• Total Trades
• Win Rate
• Profit Factor
• Expectancy (average P&L per trade)
• Net P&L
• Max Drawdown
• Average Win / Average Loss
Methodology:
• Positions held for configurable bar count (default 10 bars)
• Forces objective evaluation independent of discretionary exits
• Updates in real-time as new trades complete
Optimizer Mode:
Enable for parameter tuning research:
• Stability Score (0-100 points): Composite evaluation of parameter robustness
• Trade Density : Signals per 1000 bars — monitors over/under-trading
• Parameter Display : Current settings for documentation
• Robustness Rating : ROBUST / STABLE / FRAGILE / OVERFIT
Stability Scoring Breakdown:
• Win Rate ≥55%: +25 points | ≥50%: +15 points | ≥45%: +5 points
• Expectancy >0.5%: +25 points | >0.1%: +15 points | >0%: +5 points
• Total Trades ≥30: +25 points | ≥20: +15 points | ≥10: +5 points
• Profit Factor ≥1.5: +25 points | ≥1.2: +15 points | ≥1.0: +5 points
Target: 60+ points indicates stable parameters. Below 40 suggests overfitting risk.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CHART EXECUTION SIGNALS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Unique feature: Entry and exit markers display directly on the price chart via force_overlay, even though the indicator runs in a separate pane.
Visual Markers:
• ▲ Green Triangle (below bar): Long entry at exact price level
• ▼ Red Triangle (above bar): Short entry at exact price level
• ✕ Gold X-Cross : Position exit after hold period
Benefit: Immediate visual correlation between GoG signals and price action. Review historical trades without switching between panes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DUAL DASHBOARD SYSTEM
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Main Dashboard — Real-Time State
Displays:
• Current GoG regime (EXTREME HIGH / EXTREME LOW / NEUTRAL)
• GoG Z-Score (numerical)
• Raw GoG value
• Gamma value
• CVD (Cumulative Volume Delta)
• Volume status (Active/Low with ratio)
• Signal state (Scanning / Long Signal / Short Signal / In Position)
• Confidence meter with visual bar
• Entry price when in position
Backtest Dashboard — Performance Metrics
Displays all backtester metrics in compact format. Switches to Optimizer view when Optimizer Mode enabled.
Both dashboards feature:
• Configurable position (6 locations including Middle Left/Right)
• Adjustable text size (Tiny/Small/Normal/Large)
• Transparency control for visual integration
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PARAMETER GUIDE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Calculation Settings
• GoG Extreme Threshold (default 2.0): Z-score level for signal generation. Higher = fewer but stronger signals. Range: 0.5-5.0
• Gamma Smoothing (default 3): SMA period for Gamma. Lower = more responsive, more noise. Higher = smoother, more lag. Range: 1-20
• GoG Smoothing (default 5): SMA period for GoG. Filters micro-spikes while preserving structural inflections. Range: 1-20
• Min Volume Multiple (default 1.2): Volume must exceed this multiple of 20-period average. Ensures signals have participation backing. Range: 0.5-3.0
Backtester Settings
• Backtest Hold Bars (default 10): Forced holding period for backtester evaluation. Adjust based on timeframe and trading style.
• Parameter Optimizer Mode : Enables extended metrics for tuning research.
Tuning by Timeframe
Scalping (1-5 min):
Threshold: 1.5-2.0 | Gamma Smooth: 2-3 | GoG Smooth: 3-4 | Hold: 5-8 bars
Day Trading (15-60 min):
Threshold: 2.0-2.5 | Gamma Smooth: 3-5 | GoG Smooth: 5-7 | Hold: 8-12 bars
Swing Trading (4H-Daily):
Threshold: 2.5-3.0 | Gamma Smooth: 5-7 | GoG Smooth: 7-10 | Hold: 10-15 bars
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE: PRACTICAL WORKFLOW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Step 1: Identify Regime
Watch the GoG Z-score line. Most of the time it oscillates within the neutral zone (between thresholds). This is "scanning" mode — no actionable signal.
Step 2: Wait for Extreme
When Z-score crosses threshold AND volume confirms, a signal fires. The orb appears in the indicator pane; the triangle appears on price chart.
Step 3: Assess Confidence
Check orb size and dashboard confidence reading:
• Large bright orb + 80%+ confidence = High conviction setup
• Small faint orb + <60% confidence = Requires additional confirmation
Step 4: Execute with Context
GoG signals anticipate — they don't confirm. Use price structure (support/resistance), higher timeframe trend, or other confirmation before entry.
Step 5: Manage Position
Exit markers show backtester exits. For live trading, consider:
• Time-based exit (signal's hold period)
• Opposite signal exit
• Fixed R:R targets
Step 6: Review Performance
Check Backtest Dashboard regularly. If Win Rate drops below 45% or Expectancy goes negative, reassess parameters or market conditions.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT THIS INDICATOR IS — AND ISN'T
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This Indicator IS:
✅ State-transition detector (balance → imbalance)
✅ Early warning system for momentum shifts
✅ Anticipation tool for pre-positioning
✅ Statistical framework with built-in accountability
This Indicator IS NOT:
❌ Mechanical buy/sell system (requires discretion)
❌ Trend-following indicator
❌ Reversal-only indicator
❌ Replacement for risk management
Best Use Cases:
• Detecting early reversals before obvious confirmation
• Anticipating breakouts during volatility compression
• Timing pullback entries in established trends
• Identifying exhaustion at momentum climaxes
Challenging Conditions:
• Extremely low volume environments
• News-driven gaps (no order flow to measure)
• Instruments with unreliable volume data
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ORIGINALITY STATEMENT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Innovation 1: Third-Derivative Order Flow Analysis
While first and second derivatives are common, applying third-derivative (jerk) analysis to cumulative volume delta is novel. This captures inflection points that lower-order analysis misses entirely.
Innovation 2: Z-Score Adaptive Thresholds
Rather than fixed thresholds that require per-instrument tuning, z-score normalization creates self-adapting signal levels that work consistently across any liquid instrument.
Innovation 3: Confidence-Weighted Visual System
Dynamic orb sizing and transparency based on signal strength provides intuitive visual hierarchy. Stronger signals literally appear larger and brighter.
Innovation 4: Integrated Accountability
Built-in backtester with optimizer mode enables parameter validation directly on chart. No external tools or spreadsheets required.
Innovation 5: Dual-Pane Execution Visualization
Force-overlay chart signals bridge the gap between indicator pane and price action, enabling immediate visual trade review.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LIMITATIONS & DISCLAIMERS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Technical Limitations
• Volume classification uses bar direction (close vs prior close), not tick-level aggressor data. Precision loss estimated 10-15% vs institutional-grade data.
• CVD approximation assumes volume follows price direction. Works well in trending conditions; less precise in choppy markets.
• Backtester uses fixed hold period, not optimal exit logic. Real performance may vary with proper trade management.
Market Limitations
• Requires meaningful volume data. Avoid instruments with reported volume issues.
• Signals may cluster during high-volatility events. Not every signal should be traded.
• Anticipation signals appear early by design. Patience required — price may continue against signal briefly before reversing.
Risk Disclosure
• Trading involves risk of loss. Past performance does not guarantee future results.
• This indicator provides analysis tools, not financial advice.
• Always use proper position sizing and risk management.
• Backtest results are hypothetical and do not include slippage, commissions, or fees.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
RECOMMENDED SETTINGS BY MARKET
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Crypto (BTC, ETH, SOL)
Threshold: 1.8-2.2 | Gamma: 3 | GoG: 5 | Volume: 1.3x | TF: 15min-4H
Notes: Higher volatility produces more signals. Consider higher threshold to filter.
Forex Majors (EURUSD, GBPUSD)
Threshold: 2.0-2.5 | Gamma: 4 | GoG: 6 | Volume: 1.2x | TF: 5min-1H
Notes: Lower volatility requires patience. Volume proxy via tick volume works adequately.
Stocks (Large Cap)
Threshold: 2.0-2.5 | Gamma: 3-4 | GoG: 5-6 | Volume: 1.2x | TF: 15min-Daily
Notes: Real volume data provides cleanest signals. Watch for opening/closing auction distortions.
Futures (ES, NQ, CL)
Threshold: 2.0-2.3 | Gamma: 3 | GoG: 5 | Volume: 1.2x | TF: 5min-1H
Notes: Excellent volume data. Session boundaries may produce false signals — consider RTH only.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CONCLUSION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Gamma of Gamma represents a fundamental shift in signal philosophy: from reacting to momentum to anticipating momentum.
By operating at the third derivative of order flow, this system detects the mathematical signatures of regime transition — the moments when current pressure dynamics become unsustainable and reversal becomes probable.
This is not another oscillator telling you what already happened. This is an anticipation engine positioning you for what's about to happen.
Stop chasing. Start anticipating.
RSI tells you where momentum was. GoG tells you where it's going.
Taking you to school. - Dskyz , Trade with probability. Trade with anticipation. Trade with GoG
Advanced Market Structure [Rogman]Rogman's Advanced Market Structure Indicator
The Ultimate All-in-One Market Structure Analysis Tool for TradingView
Take your technical analysis to the next level with a comprehensive, professional-grade tool designed for traders who demand precision and clarity in their charts.
🎯 Who Is This For?
ICT/SMC Traders seeking liquidity zones and market structure analysis
Day Traders monitoring session-based price action and kill zones
Swing Traders identifying key higher timeframe levels
Price Action Traders analyzing structure breaks and trend changes
Any Serious Trader wanting a clean, comprehensive market structure overlay
✨ Key Features
📊 Market Sessions Visualization
Track the three major trading sessions with our unique bracket-style display:
Asia, London, and New York sessions are clearly marked
Sessions display as SESSION ════════════ below price action
Smart vertical stacking prevents overlapping when sessions have similar lows
Fully customizable session times for any timezone
Perfect for identifying session highs/lows and optimal kill zone timing
📈 Higher Timeframe (HTF) Levels
Never miss a key level again:
Display Daily and Weekly Open, High, and Low levels
Instant visual reference for HTF support and resistance
Separate color controls for lines and labels
Choose from Solid, Dashed, or Dotted line styles
Essential for determining HTF bias and key decision points
🔄 Automatic Swing Detection
Let the indicator do the heavy lifting:
Auto-detection of swing highs (▼) and swing lows (▲)
Configurable lookback period for sensitivity adjustment
Optional horizontal level lines extending from swing points
Customizable colors, widths, and line styles
Identify potential reversal points and structure levels instantly
💧 Liquidity Zone Mapping
See where the money is hiding:
Automatic identification of buy-side liquidity (above swing highs)
Automatic identification of sell-side liquidity (below swing lows)
Visual zones show where stop losses are clustered
Real-time tracking when liquidity gets swept
Swept zones change color — know when liquidity has been taken
📉 Multi-Method Trend Detection
Three powerful methods to confirm trend direction:
Swing Structure — Based on higher highs/lows or lower highs/lows
EMA — Trend based on price position relative to EMA
Supertrend — Uses the popular Supertrend indicator
Features include:
Optional background coloring for at-a-glance trend identification
Real-time trend status label (UPTREND/DOWNTREND/NEUTRAL)
Customizable colors and transparency
🏷️ HH/HL/LH/LL Labels
Automatic market structure labeling:
HH (Higher High) — Bullish continuation signal
HL (Higher Low) — Bullish continuation signal
LH (Lower High) — Bearish continuation signal
LL (Lower Low) — Bearish continuation signal
Color-coded for instant visual recognition
📋 Information Dashboard
All critical data at a glance:
Current ticker symbol
Trend direction and status
Daily and Weekly bias
Last swing high and low prices
Active liquidity zone count
Positionable in any corner of your chart
🔔 Built-in Alerts
Never miss a key event:
Trend change alerts (Bullish/Bearish)
Swing high/low formation alerts
Set up notifications for critical market structure changes
🎨 Fully Customizable
Every feature can be:
Toggled on/off individually via the Feature Toggles menu
Color customized to match your chart theme
Size adjusted for optimal visibility
Fine-tuned with sensitivity parameters
Organized settings groups make configuration intuitive and fast.
🚀 Why Choose This Indicator?
Feature: Benefit: All-in-One Solution. Replace multiple indicators with one comprehensive tool. Clean Design and Thoughtful visual hierarchy keep charts readable. Smart Overlap Prevention. Session bars automatically stack to avoid visual clutter. Real-Time Updates: All elements update dynamically as the price moves. Professional Quality-Built with best practices in Pine Script v6. Extensive Documentation, clear code comments, and an organized structure
📖 How to Use
Add the indicator to your TradingView chart
Enable/disable features using the Feature Toggles menu
Customize colors and settings to match your preferences
Adjust session times for your timezone
Set up alerts for trend changes and swing formations
Pro Tips:
Use session times to identify optimal entry windows during kill zones
Watch for price sweeping liquidity zones before looking for reversals
Combine HTF bias with lower timeframe entries for higher probability trades
Use swing levels as potential support/resistance for entries and targets
Monitor the dashboard for a quick market assessment before trading
⚠️ Disclaimer
This indicator is provided for educational and informational purposes only. It does not constitute financial advice. Trading involves substantial risk and is not suitable for all investors. Past performance is not indicative of future results. Always conduct your own analysis and consider your financial situation before making trading decisions.
[codapro] Elite Momentum & Smart Money Detector
Elite Momentum & Smart Money Detector
Overview
The Elite Detector is a non-repainting indicator that merges Smart Money Concepts, Adaptive Volatility-Based Momentum, and Multi-Timeframe Trend Confluence to identify high-probability trade setups. This tool helps confirm institutional intent and market pressure before triggering actionable signals.
Core Systems
Smart Money Concepts (SMC)
• Highlights institutional order blocks
• Detects equal highs/lows as liquidity zones
• Automatically cleans up outdated zones for clarity
Adaptive Momentum Engine
• Momentum calculated with volatility-adjusted smoothing
• Normalized scale from -100 to +100
• Candle coloring reflects trend strength dynamically
Squeeze Detection System
• Flags volatility contraction zones using Bollinger and Keltner channels
• Background shading highlights compression zones
• Histogram shows directional breakout pressure
Multi-Timeframe Trend Validation
• Aligns signals with higher timeframe momentum
• Built-in logic auto-selects appropriate HTF per chart
• Reduces false signals and improves timing
Signal Logic
Buy Signal appears when:
Momentum crosses from negative to positive
Squeeze condition is active
Higher timeframe confirms bullish trend
Sell Signal appears when:
Momentum crosses from positive to negative
Squeeze condition is active
Higher timeframe confirms bearish trend
All signals are non-repainting and appear only once all conditions are met.
Visual Dashboard (Top-Right Corner)
Displays real-time confirmation across five categories:
Momentum: Current trend direction and strength
Squeeze: Indicates if volatility is compressed
HTF Trend: Confirms higher-timeframe alignment
Volatility: Current volatility phase (low, normal, or high)
Signal Status: Buy, Sell, or Neutral (Wait)
Chart Visuals
Candle Colors:
• Bright green/red = Strong momentum
• Faded green/red = Weak momentum
Background Colors:
• Orange = Squeeze is active
• Clear = Normal market activity
Boxes:
• Green = Bullish order blocks
• Red = Bearish order blocks
Dashed Lines:
• Red = Equal highs (liquidity zones above)
• Green = Equal lows (liquidity zones below)
Alert Conditions
Includes three prebuilt alerts for automation and webhook systems:
Elite Buy Signal
Elite Sell Signal
Squeeze Activation
These alerts allow users to respond to market shifts in real time or integrate with automated trading workflows.
Best Practices
Wait for Confluence: Confirm all three systems (momentum, squeeze, HTF trend) before entering
Watch Order Blocks: Institutional zones often act as support/resistance
Monitor Liquidity Zones: Be cautious of stop hunts near equal highs/lows
Use Dashboard Cues: Let the HUD validate your setup
Always Use Risk Management: This tool increases probability, not certainty
Example Setup:
1. Squeeze background appears
2. Buy signal triangle confirms
3. Dashboard shows: Momentum strong up, Squeeze on, HTF trend up
4. Price bounces off green order block
→ High-probability long entry
Why It Works
This tool leverages multiple uncorrelated concepts to filter low-quality trades and highlight setups with real institutional backing:
Order Blocks and Liquidity Zones track smart money footprints
Volatility-adjusted Momentum captures real energy shifts
Multi-Timeframe Confluence confirms trades in the broader context
Non-repainting signals ensure reliability
Final Note
The Elite Detector is designed to show you:
Where smart money is positioned,
When the market is coiling for a move,
and Which direction is supported by momentum and trend.
Use it as your high-probability entry engine — across any market or timeframe.
Disclaimer
This tool was created using the CodaPro Pine Script architecture engine — designed to produce robust trading overlays, educational visuals, and automation-ready alerts. It is provided strictly for educational purposes and does not constitute financial advice. Always backtest and demo before applying to real capital.
Professional Price Action AnalysisProfessional Price Action Analysis - Advanced S/R & Pattern Detection
A comprehensive technical analysis tool combining dynamic support/resistance zones, candlestick pattern recognition, trend analysis, and volume insights.
KEY FEATURES:
✓ Dynamic Support & Resistance Zones
- Automatically identifies swing highs/lows
- Classifies levels based on current price position
- Support zones display BELOW price (green)
- Resistance zones display ABOVE price (red)
- Adjustable zone thickness and lookback period
✓ Candlestick Pattern Detection
- Bullish/Bearish Engulfing patterns
- Pin bars (reversal signals)
- Inside bars (consolidation)
- Rejection candles (wick analysis)
- Visual markers on chart with labels
✓ Trend Analysis
- Customizable moving average (default 50-period SMA)
- Background color zones for trend direction
- Price vs MA percentage calculation
- Bullish/Bearish/Neutral classification
✓ Volume Analysis
- Volume spike detection (configurable multiplier)
- Highlights unusual volume with bar colors
- Helps identify institutional activity
✓ Information Dashboard
- Clean, readable display (top-right corner)
- Current trend status
- Distance to nearest support/resistance
- Volume status (High/Normal)
- Price deviation from moving average
✓ Alert System
- Alerts for all candlestick patterns
- Volume spike notifications
- Customizable alert conditions
CUSTOMIZABLE INPUTS:
• Swing detection length (3-50 bars)
• S/R lookback period (20-200 bars)
• Zone thickness percentage
• Maximum zones displayed
• Trend MA length
• Volume spike multiplier
• Toggle individual pattern types
BEST FOR:
- Swing traders identifying key levels
- Day traders spotting reversal patterns
- Price action enthusiasts
- Multi-timeframe analysis
This indicator does not repaint. All signals are confirmed after candle close. Suitable for all markets: stocks, forex, crypto, commodities.
Educational tool for technical analysis. Not financial advice.
Mobius Trend Pivot (NPR21 v6)Mobius Trend Pivot (NPR21 v6)
Overview
This indicator identifies trend pivots using higher highs with higher lows (bullish trends) and lower lows with lower highs (bearish trends). Originally created by Mobius (V01.01.29.2019) for ThinkOrSwim, this Pine Script conversion maintains the original logic while fixing critical rendering issues found in previous TradingView versions.
How It Works
The indicator tracks price trends over a user-defined lookback period (default n=5) to establish pivot points. When a valid trend pivot forms, the indicator plots:
Red zone (bearish): Upper pivot line with confirmation level below
Green zone (bullish): Lower pivot line with confirmation level above
White dashed lines: Risk-off levels for position management
Confirmation levels are calculated as a multiple (R_Mult, default 0.7) of the Average True Range at the pivot.
Trading Rules (from Mobius original code)
Entry: Trade when price crosses and closes outside the pivot confirmation line
Risk Management: Use the pivot line itself as your risk point - exit if crossed (avoid hard stops)
Risk-Off: Target an ATR multiple for initial profit taking to achieve a risk-free trade
Stop Management: Move mental stop to break-even once risk-off is achieved
Runner Management: Adjust mental stop to new support/resistance levels as they form
What Makes This Version Different
NPR21 v6 fixes critical bugs present in other TradingView versions:
✅ Consistent transparency - The red/green cloud fills maintain constant 85% transparency and no longer progressively darken over time
✅ No overlapping renders - Eliminated the issue where multiple indicator instances would layer on top of each other, creating visual clutter
✅ Proper memory management - Implements linefill deletion/recreation logic to prevent object accumulation
✅ Clean visual display - Matches the original ThinkOrSwim appearance with professional-looking zones
Key Features
Automatic pivot detection based on price structure
Dynamic support/resistance zones
Built-in risk management levels
Alert capability for pivot confirmation crossovers
Minimal lag - responds quickly to trend changes
Works on all timeframes and instruments
Settings
n (default 5): How many bars to look back for trend confirmation
R_Mult (default 0.7): Adjusts how far the confirmation lines sit from pivots
Lower n = more sensitive, more signals
Higher n = less sensitive, fewer signals
Color Scheme
Red lines/zones: Bearish pivots and short trade setups
Green lines/zones: Bullish pivots and long trade setups
White dashed lines: Risk-off target levels
Best Practices
Use 2+ contracts to implement the risk-off strategy
Combine with price action and volume for confirmation
Adjust n and R_Mult based on instrument volatility
Works best on liquid futures and forex pairs
Consider using higher timeframes for swing trades
Credits
Original indicator concept and logic: Mobius (ThinkOrSwim, January 2019)
Pine Script conversion and optimization: NPR21
Note: This indicator is for educational purposes. Past performance does not guarantee future results. Always practice proper risk management and position sizing.
Institutional Confluence Nexus [Pro]The Problem: Noise vs. Signal
In the world of Smart Money Concepts (SMC), traders are often overwhelmed by "chart clutter." Standard indicators blindly highlight every Fair Value Gap (FVG) and Order Block (OB), regardless of whether the market is trending, ranging, or dead. This leads to analysis paralysis and low-probability entries.
The Institutional Confluence Nexus was built to solve this. It is not just a structure detector; it is a filtering engine. It uses a multi-factor model to hide low-probability zones and only highlight setups where Structure, Volume, and Momentum align.
The "Quantum" Integration
This script includes a built-in Quantum Regression Oscillator (QRO) engine running in the background. Unlike standard RSI or MACD which are reactive (lagging), the QRO uses Linear Regression mathematics to project momentum trajectory.
By combining institutional structure (Price Action) with quantum momentum (Math), this tool generates specific high-probability signals that only appear when price action and momentum are in perfect agreement.
How It Works & Visual Guide
This indicator is a complete trading suite. Here is what every symbol and color on your chart represents:
1. The "Nexus" Reversal Signals (Triangles)
Symbol : Green Triangle (Up) / Red Triangle (Down) labeled NEXUS.
Logic : These appear when price taps a valid Order Block that aligns with the macro trend (200 EMA).
Meaning : These are your primary "Trend Join" setups. They indicate that the institutional trend is resuming after a retracement.
2. High-Volume Breakouts (Bar Colors)
Symbol : Yellow Candles (Bullish) / Orange Candles (Bearish).
Logic : The script detects when a Break of Structure (BOS) occurs with Above-Average Volume.
Meaning : A breakout without volume is often a fakeout. These colored bars confirm that institutions are fueling the move. If you see a Yellow bar, it means "Smart Money" is buying the breakout.
3. QRO Confluence Signals (Labels)
These are the most advanced signals in the suite, combining Price Action with the internal Oscillator:
SNIPER (Blue/Purple) : The strongest reversal signal.
Condition : Price taps a Fair Value Gap + The internal QRO is at extreme volatility bands (Oversold/Overbought).
PB BUY / PB SELL (Aqua/Orange) : A trend continuation signal.
Condition : Price pulls back into a Fair Value Gap + The internal QRO confirms momentum is still healthy (above/below midline).
Note : These signals automatically draw a Red Line at the invalidation point (Stop Loss) to help you manage risk immediately.
4. The Confluence Dashboard
A non-intrusive Heads-Up Display (HUD) in the corner gives you a snapshot of the market state:
Trend : Is price above/below the 200 EMA?
Volume : Is current volume anomalous (High) or normal?
Structure : Are we breaking up, down, or ranging?
Settings & Customization
Smart Money Structure: Toggle FVGs and Order Blocks on/off.
FVG Extend: Control how far the gap "zones" extend to the right to see them as support/resistance zones.
Volume Filter: Enable/Disable the volume requirement (Keep enabled for higher strike rate).
Risk Management: Adjust the "Lookback" period for the automatic Stop Loss lines.
For Developers (Open Source)
I have kept the code open-source to foster learning in the Pine Script community. You can study how:
ta.linreg is used to smooth RSI data for the internal QRO engine.
box.new and line.new are used for dynamic drawing and extending zones.
var variables are used to store historical FVG levels to detect precise crossovers.
Disclaimer:
This tool is designed to assist with technical analysis and educational purposes. It does not guarantee profits. Always manage your risk and use this in conjunction with your own analysis.
Polynomial Trend Exhaustion & DivergencePolynomial Trend Exhaustion & Divergence
Overview
This indicator combines advanced polynomial regression analysis with momentum-based exhaustion detection and forecast-based divergence signals. It identifies potential trend reversals by analyzing when price momentum is fading (exhaustion) and when price direction conflicts with the mathematical trajectory projected by cubic polynomial forecasting (divergence).
The system uses optional source smoothing (Linear Regression Blend or Kalman filtering) to reduce noise before analysis, then applies two independent detection methods to generate high-probability reversal warnings.
Exhaustion Detection
What it detects: Trend exhaustion occurs when price is still moving in one direction but the underlying momentum is weakening—a classic early warning of potential reversal.
How it works:
The indicator calculates either a cubic polynomial regression or Kalman filter trend, then monitors the slope of that trend line. Exhaustion is detected when:
Bullish Exhaustion: The slope is positive (uptrend) but the rate of change of the slope is negative (momentum decelerating)
Bearish Exhaustion: The slope is negative (downtrend) but the rate of change of the slope is positive (momentum decelerating)
Signal filtering:
Consecutive Bars Required: Exhaustion conditions must persist for a configurable number of bars before triggering
Max Repeat Signals: Limits how many consecutive exhaustion signals can fire to prevent clustering
Cooldown Period: After hitting the max signal limit, the indicator pauses before allowing new signals
This produces clean, actionable warnings rather than noise during extended exhaustion phases.
Divergence Detection
What it detects: Divergence signals identify when the polynomial-projected future price path conflicts with current price direction—suggesting price may be overextended and due for a correction toward the forecast.
How it works:
The indicator fits a cubic polynomial to recent price data and extrapolates it forward by a configurable number of bars. It then compares:
Current price direction (rising or falling over the lookback period)
Forecast position (above or below current price)
Divergence triggers when:
Bullish Divergence: Price is falling but the polynomial forecast is above current price (suggesting upward reversion)
Bearish Divergence: Price is rising but the polynomial forecast is below current price (suggesting downward reversion)
Signal filtering:
Minimum Divergence (ATR): The forecast must be at least X ATRs away from price
Minimum Price Movement (ATR): Price must have moved at least X ATRs over the lookback period (filters out sideways noise)
Consecutive Bars Required: Divergence conditions must persist for X bars before triggering
Cooldown Period: Minimum bars between divergence signals of the same type
Key Features
Dual trend methods: Choose between Polynomial Regression or Kalman filtering for the base trend calculation
Source smoothing options: None, LinReg Blend, or Kalman filter applied to OHLC data before analysis
ATR-normalized thresholds: All filter thresholds adapt to current volatility
Anti-clustering logic: Built-in repeat limits and cooldowns prevent signal spam during extended conditions
Full alert support: All four signal types (Bull/Bear Exhaustion, Bullish/Bearish Divergence) have dedicated alert conditions
Hooke's Law: Market ElasticityHooke's Law: Market Elasticity is a physics-based mean reversion system that models price action using the principles of Classical Mechanics.
Most technical indicators treat the market as a purely statistical entity. This script takes a different approach, treating the market as a physical object with Mass (Volume) and Stiffness (Volatility) . By adapting Hooke’s Law of Elasticity (𝐹=−𝑘𝑋), it visualizes the "Tensile Stress" between price and its equilibrium, identifying the exact moment when a trend becomes unsustainable and must "snap back."
The Physics of Trading
In physics, Hooke's Law states that the force needed to extend a spring is proportional to the distance it is stretched. We map this to financial markets using four key components:
Equilibrium (𝑋=0): The "Resting State" of the market, calculated using a Volume-Weighted Moving Average (VWMA) . This represents the fair value where buyers and sellers agree.
2. Displacement (𝑋): The distance price travels away from this equilibrium.
3. Spring Constant (𝑘): We use Volatility (Standard Deviation) to measure the market's "stiffness."
• Low Volatility: The spring is loose; price can wander far without snapping.
• High Volatility: The spring is stiff; even small deviations create massive tension.
4. Force (𝐹): The calculation is weighted by Relative Volume . A price spike on low volume has low force (easy to reverse), while a spike on high volume carries high momentum (harder to reverse).
Visual Guide & Signals
The indicator uses a hierarchy of visuals to guide you through the trade lifecycle:
1. The Elastic Ribbon (Heatmap)
Connects Price to the Baseline. As the ribbon turns Solid White , the market has reached its Elastic Limit (Critical Zone). This is your warning that a move is overextended.
2. The "Golden" Labels (LONG / SHORT)
These are your Entry Signals . They appear only when the physics "snap" is confirmed by an internal momentum filter and price action.
3. The Small Circles (Minor Reversions)
These dots represent "Minor Snaps." They occur when the elastic tension releases, but the momentum filter hasn't fully confirmed a major reversal.
• Usage: These are excellent Early Warning signs or Scale-In points for aggressive traders.
Strategy: Entries, Exits & Take Profits
This script is designed as a complete system. Here is how to manage the trade using the visual cues:
• Entry: Wait for a LONG or SHORT label to appear.
• Stop Loss: Use the Solid White Line that appears automatically with the signal. If price touches this line, the physics setup has failed—exit immediately.
• Take Profit 1 (The Equilibrium): The Gray Baseline represents the market's center of gravity. In mean reversion trading, price tends to snap back to this line. This is the statistically highest-probability target.
• Take Profit 2 (The Circles): If you are in a trade and a Circle appears in the opposite direction, it indicates the market is experiencing counter-tension. This is an ideal place to secure partial profits or trail your stop.
Settings & Configuration
• Baseline Length (Default: 34): The lookback period for the Center of Gravity.
• Elasticity Limit (Default: 2.618): The Golden Ratio is used as the standard deviation threshold for the "Critical Zone."
• Volume Weighting (Default: True): Recommended. Adds the "Mass" component to the physics calculation.
• Stop Loss Buffer (Default: 0.5): The distance (in Sigma) for the Stop Loss placement.
Risk Disclaimer
Not Financial Advice: This indicator is designed for educational and analytical purposes only. It visualizes market data based on mathematical formulas (Hooke's Law and Statistical Deviation) and does not guarantee future performance or profits.
Market Risks: Financial trading involves significant risk. The "Critical Zones" and "Signals" generated by this script identify statistical extremes, but markets can remain irrational or overextended for long periods ("Plastic Deformation").
Usage: Do not trade blindly based on these signals. Always use this tool in conjunction with your own analysis, risk management, and stop-losses. The author assumes no responsibility for any trading losses incurred while using this script.
ApEn Zones with Delta Confirmation MTF [PhenLabs]📊 ApEn Zones with Delta Confirmation MTF
Version: PineScript™ v6
📌 Description
The ApEn Zones with Delta Confirmation MTF indicator combines Approximate Entropy analysis with cumulative volume delta to identify high-probability support and resistance zones. Approximate Entropy (ApEn) measures the complexity and unpredictability in price data—when ApEn drops significantly, it signals a transition from chaotic to ordered market behavior, often preceding reversals or continuations.
This indicator goes beyond simple ApEn detection by integrating Delta confirmation, which validates zones using volume-based order flow analysis. When a zone forms with Delta confirmation, it indicates institutional participation aligning with the price structure. The multi-timeframe capability allows traders to detect zones forming on higher timeframes while executing on their preferred chart.
🚀 Points of Innovation
First indicator to combine ApEn complexity analysis with cumulative Delta confirmation for zone validation
Pre-built calculation presets eliminate guesswork—optimized parameters for scalping, day trading, and swing trading
Smart zone management automatically removes invalidated zones after two price rejections
Multi-timeframe architecture detects zones on configurable timeframes independent of chart timeframe
Visual style presets provide instant customization from high contrast to subtle overlays
Delta threshold system distinguishes between regular zones and institutionally-confirmed zones
🔧 Core Components
ApEn Calculator: Measures pattern regularity using embedding dimension (m=2) and tolerance factor (r) against price standard deviation to quantify market complexity
Delta Engine: Computes cumulative delta from volume and price movement, comparing against statistical thresholds to identify significant order flow divergence
Zone Generator: Creates visual box zones at signal points with dynamic sizing based on bar range and confirmation status
MTF Request Handler: Fetches ApEn calculations from user-specified timeframe using security() calls for higher timeframe alignment
Zone Manager: Tracks zone interactions, counts rejections, and automatically purges zones that have been tested twice
🔥 Key Features
Calculation Presets: Choose from Aggressive, Conservative, Scalping 1m, Strong Scalping, Swing Trading, or Default—each preset optimizes all parameters for specific trading styles
Visual Style Presets: Select Default, High Contrast, Subtle, Classic, Neutral, or Neutral Reverse to match your chart theme and preference
Delta Confirmation: Zones display with enhanced opacity when cumulative delta confirms institutional participation in the direction of the zone
Automatic Zone Cleanup: Zones self-destruct after two rejections, keeping your chart clean and focused on active levels
Alert System: Four alert conditions for buy zones, sell zones, strong buy signals, and strong sell signals
Maximum Zone Control: Limits display to 5 zones per direction to prevent chart clutter
🎨 Visualization
Buy Zones: Displayed as horizontal boxes at low points when ApEn crosses under threshold—lighter transparency indicates regular zone, darker indicates Delta confirmation
Sell Zones: Displayed as horizontal boxes at high points when ApEn crosses over threshold—visual confirmation follows same transparency logic
Zone Boundaries: Each zone extends 10% of bar range above and below the signal level, providing clear entry and stop areas
Dynamic Extension: All zones automatically extend rightward with each new bar until invalidated
📖 Usage Guidelines
Calculation Preset Selection
Scalping 1m / Strong Scalping: Use for 1-5 minute charts with faster signal generation and tighter thresholds (Length: 15, Zone Length: 5)
Aggressive: Shorter lookback (Length: 10) generates more zones with lower confirmation requirements—higher frequency, more noise
Default: Balanced parameters suitable for 5-15 minute charts (Length: 15, Zone Threshold: 0.5, Delta Length: 4)
Conservative: Extended lookback (Length: 30) with stricter thresholds—fewer but higher probability zones
Swing Trading: Longest parameters (Length: 40, Zone Length: 20) for 1H-4H charts capturing major structural zones
Visual Style Selection
High Contrast: Bright green/red for maximum visibility on any background
Subtle: Muted green/red with transparency for minimal chart distraction
Classic: Traditional lime green and crimson color scheme
Neutral / Neutral Reverse: Grayscale tones for non-directional bias visualization
Timeframe Configuration
Default timeframe is set to 1 minute—adjust based on your execution timeframe
For scalping: Set zone timeframe 1-3x your chart timeframe
For swing trading: Set zone timeframe to 4H or Daily while viewing 1H charts
✅ Best Use Cases
Identifying reversal zones during high-volatility market conditions
Confirming support/resistance levels with volume-based order flow validation
Scalping entries on lower timeframes with higher timeframe zone confluence
Filtering trade setups by requiring Delta confirmation before entry
Setting stop losses beyond zone boundaries after rejection tests
Swing trade positioning at zones detected on 4H/Daily timeframes
⚠️ Limitations
ApEn calculations are computationally intensive—may experience slower loading on very long chart histories
Delta estimation uses (close - open) * volume approximation, not actual order flow data
Zones require sufficient price history—indicator needs max_bars_back of 2000 bars for proper calculation
Low volume instruments may produce unreliable Delta confirmation signals
Zone rejections are counted based on price interaction, not candle close confirmation
Maximum of 5 zones per direction limits visibility during highly active markets
💡 What Makes This Unique
Entropy-Based Detection: Uses mathematical complexity analysis rather than simple price patterns to identify zones
Dual Confirmation System: Combines ApEn signals with Delta divergence for higher probability setups
Adaptive Presets: Six calculation presets and six visual styles create 36 possible configurations without manual parameter adjustment
Self-Managing Zones: Automatic invalidation after two rejections mimics how professional traders track level degradation
🔬 How It Works
Step 1 - ApEn Calculation: The indicator computes Approximate Entropy by measuring how often similar patterns of length m repeat within tolerance r multiplied by standard deviation—lower values indicate more predictable (ordered) price behavior
Step 2 - Signal Generation: Buy signals trigger when higher timeframe ApEn crosses under the average ApEn divided by threshold; sell signals trigger when ApEn crosses over average multiplied by threshold
Step 3 - Delta Confirmation: Cumulative delta is compared against its moving average plus/minus standard deviation times threshold—extreme readings confirm institutional order flow alignment
Step 4 - Zone Creation: Visual boxes are drawn at signal bars with dimensions based on bar range; confirmed zones receive enhanced opacity while unconfirmed zones appear more transparent
Step 5 - Zone Lifecycle: Active zones extend with each bar and track price interactions; after two rejections (price touches zone but reverses), the zone is automatically deleted
💡 Note:
This indicator works best when combined with trend analysis and market structure. Use calculation presets as starting points and adjust the Zone Timeframe setting to align with your trading methodology. Delta confirmation significantly improves zone reliability but requires volume data—instruments with low or unreported volume should rely primarily on ApEn signals alone. Always validate signals with price action context before executing trades.
RSI Swing Indicator// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
//
// DESCRIPTION:
// This is an improved version of the original RSI Swing Indicator created by BalintDavid.
// It highlights swing moves between RSI overbought/oversold extremes and updates swing labels
// as price pushes to new highs or lows inside the same RSI regime.
//
// HOW TO USE:
// 1) Set the RSI source, length, and overbought/oversold levels in Inputs.
// 2) Watch the swing lines connect the last oversold to overbought (and vice-versa).
// 3) Labels show structure: HH (higher high), LH (lower high), HL (higher low), LL (lower low).
// 4) Enable "Show only last connecting line" to keep just the most recent connection.
//
// CONTACT:
// ronbelson@gmail.com
//
ChannellerChanneller Pro - Multi-Pivot Regression Channels with Trend Validation
What This Indicator Does
Channeller Pro automatically detects and draws price channels by connecting multiple pivot points using linear regression rather than simply connecting two points. The indicator displays parallel support and resistance lines that define the current trend channel, along with an optional mid-line for mean reversion analysis.
Channels automatically appear when valid trend conditions are met and disappear when the trend structure breaks, keeping your chart clean and showing only actionable information.
---
How It Works (Methodology)
1. Multi-Pivot Linear Regression
Unlike simple channel indicators that connect only 2 pivot points, this indicator collects 3-5 pivot lows (for bullish channels) or pivot highs (for bearish channels) and calculates a least-squares linear regression line through them. This produces a statistically best-fit trendline that is more resistant to noise from a single errant pivot.
The regression calculation outputs:
- Slope: The angle/direction of the trend
- Intercept: The starting price level
- R² (coefficient of determination): A value from 0 to 1 measuring how well the pivot points align. Higher R² means the pivots form a cleaner, more reliable trendline. The default minimum is 0.70.
2. Higher-Low / Lower-High Pattern Validation
For a bullish channel to form, the indicator requires each successive pivot low to be higher than the previous pivot low (the definition of an uptrend). For bearish channels, each pivot high must be lower than the previous (downtrend structure). This filter prevents channels from forming during choppy, non-trending conditions.
3. ADX Trend Strength Filter
The indicator calculates the Average Directional Index (ADX) to measure trend strength. Channels only appear when ADX exceeds a user-defined threshold (default: 20). When ADX drops below this level, indicating the trend has weakened, channels automatically disappear. This prevents false channels during sideways/ranging markets.
4. Channel Width Calculation
Once the regression support line is established, the indicator finds the highest high (for bull channels) or lowest low (for bear channels) between the first and last pivot. A parallel line is drawn at this distance to form the opposite channel boundary.
5. Channel Respect Monitoring
The indicator tracks how price interacts with channel boundaries:
- Bounces: Price touches the boundary and reverses
- Pierces: Price closes beyond the boundary
If price pierces through a channel boundary multiple times, the channel is invalidated and removed, signaling the trend structure has broken.
---
How to Use This Indicator
Identifying Trends
- A green channel (bullish) indicates an uptrend with higher lows
- A red channel (bearish) indicates a downtrend with lower highs
- The R² value in the label shows channel quality (higher = more reliable)
Trading Applications
- Trend Following: Trade in the direction of the channel slope
- Support/Resistance: Use channel boundaries as potential reaction zones
- Mean Reversion: The optional mid-line (dashed) can serve as a target for pullback entries
- Breakout Preparation: When a channel disappears, it signals the prior trend structure has ended
Reading the Labels
- "BULL R²:0.85 (4 pivots)" means a bullish channel with 85% regression fit using 4 pivot points
- Orange-colored labels indicate weaker channels (R² between 0.70-0.85)
- Green/red labels indicate stronger channels (R² above 0.85)
---
Input Settings Explained
| Setting | Description |
|---------|-------------|
| Pivot Lookback Left/Right | Bars required on each side to confirm a pivot high/low |
| Min Pivots for Channel | Minimum pivot points required (more = stricter) |
| Max Pivots to Track | Maximum pivots stored (older pivots are dropped) |
| Min R² Score | Minimum regression quality (0.70 = 70% fit) |
| ADX Threshold | Minimum ADX value to show channels (20 = moderate trend) |
| Require HL/LH Pattern | Enforce higher-lows for bull, lower-highs for bear |
---
What Makes This Different
This indicator combines multiple validation layers that work together:
1. Regression vs. 2-point lines: More statistically robust trendlines
2. R² quality scoring: Quantifies how clean the trend structure is
3. Pattern validation: Ensures proper trend structure (HL/LH)
4. ADX filtering: Confirms trend exists before drawing channels
5. Auto-invalidation: Channels disappear when broken, not manually
These components create a self-cleaning channel system that only displays high-probability trend channels.
---
Alerts Available
- Bull/Bear Channel Formed
- Bull/Bear Channel Broken
- New Pivot High/Low Detected
SWING ATR BasedWhat does this indicator do?
1. It identifies Market Swings The script monitors price action to detect when a trend changes direction.
It uses ATR (Average True Range) to measure volatility, ensuring it doesn't get tricked by small, insignificant price movements.
To validate a change in direction (from bullish to bearish, or vice versa), it waits for the price to cover a specific distance (defined by the kRange parameter) and requires at least two significant candles.
2. It plots Support and Resistance zones As soon as a new high or low point is confirmed:
In Green (Bull): It draws a support line at the level of the last low.
In Red (Bear): It draws a resistance line at the level of the last high.
Auto-Cleaning: If the price breaks through a support line, the line turns gray and stops. The script only keeps active (unbroken) levels on the screen.
3. It calculates an "SGE Score" (Market State) This is the "brain" of the script. It assigns a rating to the current trend:
+2 (Bullish): The price has broken a resistance.
-2 (Bearish): The price has broken a support.
0 (Neutral): The market is indecisive (for example, after a break that contradicts the previous one).
Key Feature: This score has a "one-candle delay." It waits for the next candle to close before confirming a score change, which helps avoid reacting too quickly to false alerts.
4. It simplifies visual reading To keep your chart clean and readable:
It only highlights the 3 levels closest to the current price (those most likely to be hit soon).
It colors the chart candles directly: Green if the score is +2, Red if the score is -2, and Gray if it is neutral.
5. Dashboard In the top-right corner of your screen, it displays a permanent summary:
The current score (-2, 0, or 2).
The number of active supports and resistances.
Summary: This is a "smart" trend detector. Instead of just looking at whether the price is going up or down, it waits for the price to break important structural levels (confirmed by volatility) to tell you: "Caution, the structure has just shifted from bullish to bearish."
Recommended Settings:
kRange: 1.3 / 1.4
ATR Mult: 0.3 to 0.5
Script created with Claude AI.
High Volume S/R + VPA Entries + Broken Level Cleanup High Volume S/R + VPA Entries + Broken Level Cleanup
Weinstein Stage AnalysisWeinstein Stage Analysis
This is an enhanced version of Stan Weinstein's classic Stage Analysis, optimized for visual clarity on dark themes. The indicator instantly colors your candlesticks based on the current Weinstein Stage using a bright, fully opaque color scheme that stands out strongly even on dark charts.
Key Features:
- Uses Weekly 30-period SMA (customizable length) as the primary reference line
- Supports "Within Range %" parameter – set to 0% for super-strong stocks that must stay clearly above/below the MA
- Four distinct stages with vivid colors:
• Stage 1 (Accumulation) – Bright Cyan (#00FFFF) – Stock is basing or consolidating near the MA
• Stage 2 (Uptrend) – Bright Green (#00CD00) – Strong uptrend, price clearly above the weekly MA
• Stage 3 (Topping) – Bright Orange (#FFAA00) – Price is still above MA but weakening (potential distribution)
• Stage 4 (Downtrend) – Bright Red (#FF0000) – Strong downtrend, price clearly below the weekly MA
- Automatic stage transition logic with perfect color persistence (no flickering)
- Super visible on both light and dark themes – colors are 100% opaque and highly saturated
- Plots the Weekly 30 SMA as a thick white line for easy reference
How to Use:
1. Add to any chart (works best on daily or weekly timeframes)
2. For very strong momentum stocks, set "Within Range %" to 0% – this forces the indicator to only show Stage 2 when price is clearly above the MA
3. Use default 30-period length or adjust based on your preference
4. Watch for clean stage transitions – especially the switch from Stage 3 (orange) to Stage 4 (red) as a strong sell signal, or Stage 1 (cyan) to Stage 2 (green) as a powerful buy signal
Dynamic Zone TraderDynamic Zone Trader - MACD-based trading system with adaptive stop loss and take profit zones.
This indicator generates buy/sell signals from MACD histogram crossovers and automatically adjusts position sizing based on market conditions.
Key Features:
Detects breakout trades and expands targets to capture larger moves
Identifies choppy/ranging conditions and tightens stops to reduce risk
Shows supply and demand zones based on pivot highs/lows
Displays three take profit levels (TP1, TP2, TP3) that scale with trade quality
Entry signals filtered by 50 EMA to trade with the trend
Signal strength score displayed on each entry marker
How It Works:
The indicator analyzes recent price structure and movement to classify each trade:
Breakout trades (breaking recent highs/lows) get 1.6x larger zones
Normal trades get standard 1.0x sizing
Choppy weak signals get 0.75x smaller zones
This allows you to take bigger positions on high-conviction setups while limiting risk during low-quality trades.
Settings:
MACD parameters (default 8/21/5)
Base stop loss: 60 ticks
Base take profit: 80 ticks
EMA filter: 50 period
Optional ADX trend filter
Adjustable breakout detection sensitivity
Works on any timeframe and instrument, but optimized for index futures like NQ/MNQ.
Anchored LRL using ZigZag AnchorAnchored Linear Regression Channel - ZigZag Pivot
The Anchored Linear Regression Channel (LRL) dynamically anchors to the most recent ZigZag pivot point, providing traders with a regression-based channel that resets with each significant price swing.
HOW IT WORKS:
This indicator combines ZigZag pivot detection with linear regression analysis. When price reverses by a specified ATR multiple, a new pivot is identified. After a minimum number of bars, the linear regression channel anchors to this pivot and projects forward to the current bar, recalculating with each new bar.
KEY FEATURES:
- Dynamic anchoring to ZigZag highs and lows
- Customizable ATR-based reversal detection
- Two standard deviation channel bands (inner and outer)
- Adjustable minimum bars before anchor reset (ideal for scalping on lower timeframes)
- Separate controls for ZigZag smoothing vs. anchor reset timing
- Color-coded regression line (up/down trend)
- Optional line extension to the right
- Fully customizable colors and line widths
- Visual label marking the anchor pivot point
INPUTS:
- ATR Reversal: Multiplier for ATR-based pivot detection (default: 2.0)
- MA Length: EMA smoothing for ZigZag calculation (default: 5)
- ATR Length: Period for ATR calculation (default: 5)
- Min Bars After Pivot: Bars required before anchor resets (default: 3, reduce to 1-2 for faster scalping)
- Channel Widths: Inner (0.70) and Outer (1.00) standard deviation multiples
- Line Colors: Customizable colors for uptrend/downtrend and channel lines
- Label Colors: Customizable background and text colors
HOW TO USE:
1. Apply the indicator to your chart
2. Adjust "Min Bars After Pivot" based on your timeframe:
- 1-minute charts: Use 1-2 bars for quick scalping entries
- 5-minute+ charts: Use 3-5 bars for more confirmation
3. Watch for the regression line color to indicate trend direction
4. Use channel bands as potential support/resistance zones
5. The label shows which pivot (high/low) the channel is anchored to
BEST PRACTICES:
- Lower timeframes (1-5 min): Use lower "Min Bars After Pivot" (1-3) for faster reaction
- Higher timeframes: Use higher values (5+) for more confirmed pivots
- Combine with price action and volume for confirmation
- Adjust ATR Reversal based on instrument volatility
NOTES:
- This indicator repaints as it recalculates with each new bar
- Channel resets when a new ZigZag pivot is confirmed
- Not suitable for backtesting strategies due to dynamic nature
- Works best on liquid instruments with clear price swings
DISCLAIMER:
This indicator is for educational and informational purposes only. It does not provide trading signals or guarantees of profitability. Past performance is not indicative of future results. Always perform your own analysis and risk management.
Order Blocks INDIBOT 3D | INDIBOT ABO SALTAN 11 //@version=6
indicator("Order Blocks INDIBOT 3D | INDIBOT ABO SALTAN ", overlay = true,
max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500, max_polylines_count = 100, max_bars_back = 5000)
//#region CONSTANTS
// Core constants that control stored OB capacity and label size.
const int MAX_STORED_OBS = 50
const int retestSize = 4
//#endregion
//#region INPUTS
// Core user controls for OB behavior, volume delta, 3D style and alerts.
grpOB = "ORDER BLOCKS"
swingLen = input.int(5, "Swing Length", minval = 1, group = grpOB, inline = "sw", display = display.none)
bullObColor = input.color(color.new(color.teal, 55), "", group = grpOB, inline = "sw")
bearObColor = input.color(color.new(color.red, 55), "", group = grpOB, inline = "sw")
invMethod = input.string("Wick", "Invalidation", options = , group = grpOB, display = display.none)
showNearestX = input.int(3, "Show Nearest", minval = 1, maxval = 20, group = grpOB, display = display.none)
extendZones = input.int(10, "Extend Zones", minval = 0, group = grpOB,
tooltip = "This will extend the zones by X candles.", display = display.none)
showRetestLbl = input.bool(true, "Retest Labels", group = grpOB, inline = "tog")
hideInvalid = input.bool(true, "Hide Invalidated Zones", group = grpOB, inline = "tog")
grpVD = "VOLUME DELTA"
vdEnable = input.bool(true, "Enable", group = grpVD, inline = "vd")
vdBullColor = input.color(color.new(color.teal, 65), "", group = grpVD, inline = "vd")
vdBearColor = input.color(color.new(color.red, 65), "", group = grpVD, inline = "vd")
vd3D = input.bool(true, "3D", group = grpVD, inline = "3d", tooltip = "Adds 3D-style depth faces.") and vdEnable
vd3DDepth = input.int(5, "", group = grpVD, inline = "3d", minval = 1, maxval = 5, display = display.none)
displayStyle = input.string("Vertical", "Display Style", options = , group = grpVD,
tooltip = "Horizontal: split shown top/bottom. Vertical: split shown left/right across the zone.", display = display.none)
vdTfIn = input.timeframe("", "Volume Delta Timeframe", group = grpVD,
tooltip = "Lower timeframe used to estimate delta")
showTotalVol = input.bool(true, "Display Total Volume", group = grpVD,
tooltip = "Displays total volume (Bull+Bear) from the active delta source.", inline = "vd2") and vdEnable
showDeltaPct = input.bool(true, "Show Delta %", group = grpVD, inline = "vd2",
tooltip = "Shows bullish vs bearish volume split. If selected TF is lower than chart TF, uses LTF data; otherwise uses chart TF.") and vdEnable
vdTextColor = input.color(color.white, "", group = grpVD, inline = "vd2")
grpAL = "ALERTS"
alBullOB = input.bool(true, "Bullish Order Block", group = grpAL, inline = "oba")
alBearOB = input.bool(true, "Bearish Order Block", group = grpAL, inline = "oba")
alBullRetest = input.bool(true, "Bullish OB Retest", group = grpAL, inline = "obr")
alBearRetest = input.bool(true, "Bearish OB Retest", group = grpAL, inline = "obr")
//#endregion
//#region TYPES
// Custom structs for order blocks and 3D poly drawing.
type PolyParams
array points
color lineColor
color fillColor
int lineWidth
type ObRec
int leftIndex
int leftTime
int createdIndex
int createdTime
float top
float bottom
bool isBull
bool active
bool retested
int retestIndex
int retestTime
int invalidIndex
int invalidTime
float bullVol
float bearVol
float totalVol
float bullPct
float bearPct
bool hasDelta
type RetestRec
int barIndex
bool isBull
int obLeftIndex
int obCreatedIndex
//#endregion
//#region GENERIC HELPERS
// Small utilities: clearing drawings, geometry helpers, nearest-OB picking.
method clearAll(array bx, array pl, array lb) =>
if bx.size() > 0
for i = 0 to bx.size() - 1
bx.get(i).delete()
bx.clear()
if pl.size() > 0
for i = 0 to pl.size() - 1
pl.get(i).delete()
pl.clear()
if lb.size() > 0
for i = 0 to lb.size() - 1
lb.get(i).delete()
lb.clear()
// Builds a simple side face for 3D-style boxes using chart points.
method sideBox(array pts, int x, float btm, float top, float depthY, int widthX) =>
pts.unshift(chart.point.from_index(x, btm))
pts.unshift(chart.point.from_index(x + widthX, btm + depthY))
pts.unshift(chart.point.from_index(x + widthX, top + depthY))
pts.unshift(chart.point.from_index(x, top))
pts.unshift(chart.point.from_index(x, btm))
// Returns true if a candle's high/low intersects the OB zone.
touchesZone(float zTop, float zBot, float cHigh, float cLow) =>
cHigh >= zBot and cLow <= zTop
// Distance from price to zone in price units, used to rank nearest zones.
zoneDistance(float px, float zTop, float zBot) =>
px > zTop ? px - zTop : px < zBot ? zBot - px : 0.0
// Inserts a distance+index pair into a sorted list, capped at kMax.
method insertBest(array dists, array idxs, float dist, int idx, int kMax) =>
if dists.size() == 0
dists.push(dist)
idxs.push(idx)
else
int pos = dists.size()
if dists.size() > 0
for j = 0 to dists.size() - 1
if dist < dists.get(j)
pos := j
break
dists.insert(pos, dist)
idxs.insert(pos, idx)
while dists.size() > kMax
dists.pop()
idxs.pop()
// Picks the k nearest bull/bear OBs to current price (optionally including invalid).
pickNearest(array store, bool wantBull, int kMax, bool includeInvalid) =>
array dists = array.new_float()
array idxs = array.new_int()
if store.size() > 0
for i = 0 to store.size() - 1
ObRec ob = store.get(i)
if ob.isBull == wantBull
bool ok = includeInvalid ? true : ob.active
if ok
float dist = zoneDistance(close, ob.top, ob.bottom)
dists.insertBest(idxs, dist, i, kMax)
idxs
formatVol(float v) =>
str.tostring(v, format.volume)
//#endregion
//#region VOLUME ENGINE (CHART OR LOWER TF)
// Per-bar total / bull / bear volume
tfSec(string tf) =>
timeframe.in_seconds(tf)
int chartSec = tfSec(timeframe.period)
int srcSec = tfSec(vdTfIn)
bool useLtf = not na(chartSec) and not na(srcSec) and srcSec < chartSec
getBarVols() =>
float tot = na
float bull = na
float bear = na
if not useLtf or vdTfIn == ""
float v = volume
bool up = close > open
bool dn = close < open
tot := v
bull := up ? v : 0.0
bear := dn ? v : 0.0
else
array oArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, open)
array cArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, close)
array vArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, volume)
float tSum = 0.0
float bSum = 0.0
float sSum = 0.0
int n = array.size(vArr)
if n > 0
for i = 0 to n - 1
float v2 = array.get(vArr, i)
float o2 = array.get(oArr, i)
float c2 = array.get(cArr, i)
tSum += v2
if c2 > o2
bSum += v2
else if c2 < o2
sSum += v2
tot := tSum
bull := bSum
bear := sSum
= getBarVols()
//#endregion
//#region POC ENGINE (MOST-TOUCHED PRICE + VOLUME)
// Finds a POC between swing and BOS, then aggregates volume.
findMostTouchedPrice(int fromIdx, int toIdx, int nBins) =>
int span = toIdx - fromIdx
if span <= 0 or na(fromIdx) or na(toIdx)
else
float minP = 1e10
float maxP = -1e10
for idx = fromIdx to toIdx
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi)
if lo < minP
minP := lo
if hi > maxP
maxP := hi
if not (minP < maxP)
else
float step = (maxP - minP) / nBins
step := step <= 0 ? syminfo.mintick : step
array diffCnt = array.new_float(nBins, 0.0)
for idx = fromIdx to toIdx
int rel2 = bar_index - idx
if rel2 >= 0
float lo2 = low
float hi2 = high
if not na(lo2) and not na(hi2)
int sBin = int(math.floor((lo2 - minP) / step))
int eBin = int(math.floor((hi2 - minP) / step))
sBin := sBin < 0 ? 0 : sBin > nBins - 1 ? nBins - 1 : sBin
eBin := eBin < 0 ? 0 : eBin > nBins - 1 ? nBins - 1 : eBin
float cStart = diffCnt.get(sBin)
diffCnt.set(sBin, cStart + 1.0)
if eBin + 1 < nBins
float cEnd = diffCnt.get(eBin + 1)
diffCnt.set(eBin + 1, cEnd - 1.0)
int bestBin = 0
float bestCnt = 0.0
float runCnt = 0.0
for i = 0 to nBins - 1
runCnt += diffCnt.get(i)
if runCnt > bestCnt
bestCnt := runCnt
bestBin := i
float poc = minP + (bestBin + 0.5) * step
// Aggregates total / bull / bear volume at a single price level (POC) for a range.
volumeAtPrice(int fromIdx, int toIdx, float poc) =>
int touches = 0
float totVol = 0.0
float bullVol = 0.0
float bearVol = 0.0
int span = toIdx - fromIdx
if not na(poc) and span >= 0
for step = 0 to span
int idx = toIdx - step
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi) and lo <= poc and hi >= poc
touches += 1
float vTot = barTotVol
float vBull = barBullVol
float vBear = barBearVol
if not na(vTot)
totVol += vTot
if not na(vBull)
bullVol += vBull
if not na(vBear)
bearVol += vBear
// Wrapper: find POC first, then compute volume at that POC for the BOS range.
calcMostTouchedPriceVol(int fromIdx, int toIdx, int nBins) =>
= findMostTouchedPrice(fromIdx, toIdx, nBins)
= volumeAtPrice(fromIdx, toIdx, poc)
//#endregion
//#region ORDER BLOCK ENGINE (POC-BASED)
// Detects swing highs/lows, confirms BOS, anchors OB at first POC touch.
var array obs = array.new()
var array obRetests = array.new()
var int lastBullRetestBar = na
var int lastBearRetestBar = na
var float shPrice = na
var int shIdx = na
var float slPrice = na
var int slIdx = na
bool evNewBullOB = false
bool evNewBearOB = false
bool evBullRetest = false
bool evBearRetest = false
float ph = ta.pivothigh(high, swingLen, swingLen)
float pl = ta.pivotlow(low, swingLen, swingLen)
if not na(ph)
shPrice := ph
shIdx := bar_index - swingLen
if not na(pl)
slPrice := pl
slIdx := bar_index - swingLen
bool bosBearNow = not na(slPrice) and bar_index > slIdx and close < slPrice and close >= slPrice
bool bosBullNow = not na(shPrice) and bar_index > shIdx and close > shPrice and close <= shPrice
bool bosBear = bosBearNow
bool bosBull = bosBullNow
// Precompute BOS ranges and POC stats in global scope
int bosIdxBear = bar_index - 1
int fromIdxBear = slIdx
int toIdxBear = bosIdxBear
= calcMostTouchedPriceVol(fromIdxBear, toIdxBear, 40)
int bosIdxBull = bar_index - 1
int fromIdxBull = shIdx
int toIdxBull = bosIdxBull
= calcMostTouchedPriceVol(fromIdxBull, toIdxBull, 40)
// Keeps OB array trimmed to recent history and limits max stored OBs.
pruneObs() =>
int minLeft = math.max(0, bar_index - 4999)
if obs.size() > 0
for i = obs.size() - 1 to 0
ObRec ob = obs.get(i)
if ob.leftIndex < minLeft
obs.remove(i)
while obs.size() > MAX_STORED_OBS
bool removed = false
if obs.size() > 0
for j = obs.size() - 1 to 0
ObRec ob2 = obs.get(j)
if not ob2.active
obs.remove(j)
removed := true
break
if not removed and obs.size() > 0
obs.pop()
// Creates and seeds an OB record using a POC-anchored candle and BOS volumes.
addObFromPoc(int baseIdx, float top, float bottom, bool isBull, float totSeed, float bullSeed, float bearSeed, int createdIdx) =>
int offLeft = bar_index - baseIdx
int offCreated = bar_index - createdIdx
int leftTime = time
int createdTm = time
float tot = totSeed
float bVol = bullSeed
float sVol = bearSeed
bool hasDelta = tot > 0.0
float bullPct = hasDelta ? math.round((bVol / tot) * 100.0) : 50.0
float bearPct = hasDelta ? 100.0 - bullPct : 50.0
obs.unshift(ObRec.new(baseIdx, leftTime, createdIdx, createdTm, top, bottom, isBull,
true, false, na, na, na, na, bVol, sVol, tot, bullPct, bearPct, hasDelta))
pruneObs()
// Returns true if a proposed zone overlaps any active OB
obOverlapsActive(float zoneTop, float zoneBottom) =>
float zTop = math.max(zoneTop, zoneBottom)
float zBot = math.min(zoneTop, zoneBottom)
bool overlaps = false
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec ob = obs.get(i)
if ob.active
float oTop = math.max(ob.top, ob.bottom)
float oBot = math.min(ob.top, ob.bottom)
bool rangeOverlap = zTop >= oBot and zBot <= oTop
if rangeOverlap
overlaps := true
break
overlaps
// Returns true if there is a price gap between anchorIdx and bosIdx.
hasGapBetween(int anchorIdx, int bosIdx, bool isBull) =>
bool gap = false
int fromIdx = math.min(anchorIdx, bosIdx)
int toIdx = math.max(anchorIdx, bosIdx)
if toIdx - fromIdx >= 1
for absIdx = fromIdx + 1 to toIdx
int relNow = bar_index - absIdx
int relPrev = relNow + 1
if relNow >= 0 and relPrev >= 0
float hiPrev = high
float loPrev = low
float hiNow = high
float loNow = low
if not na(hiPrev) and not na(loPrev) and not na(hiNow) and not na(loNow)
if isBull
if loNow > hiPrev
gap := true
break
else
if hiNow < loPrev
gap := true
break
gap
// Bearish BOS → Bearish OB
if bosBear
int bosIdx = bosIdxBear
int fromIdx = fromIdxBear
int toIdx = toIdxBear
if not na(pocB) and touchesB > 0 and not na(fromIdx) and not na(toIdx)
int spanB = toIdx - fromIdx
int bestIdx = na
float runMaxHigh = na
if spanB >= 0
for step = 0 to spanB
int idx = toIdx - step
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi)
runMaxHigh := na(runMaxHigh) ? hi : math.max(runMaxHigh, hi)
bool touches = lo <= pocB and hi >= pocB
if touches and hi == runMaxHigh
bestIdx := idx
bool gapLeg = not na(bestIdx) ? hasGapBetween(bestIdx, bosIdx, false) : false
if not na(bestIdx) and not gapLeg
int relBest = bar_index - bestIdx
float top = high
float bottom = low
if not obOverlapsActive(top, bottom)
addObFromPoc(bestIdx, top, bottom, false, totVolB, bullVolB, bearVolB, bosIdx)
evNewBearOB := true
slPrice := na
slIdx := na
// Bullish BOS → Bullish OB
if bosBull
int bosIdx2 = bosIdxBull
int fromIdx2 = fromIdxBull
int toIdx2 = toIdxBull
if not na(pocH) and touchesH > 0 and not na(fromIdx2) and not na(toIdx2)
int spanH = toIdx2 - fromIdx2
int bestIdx2 = na
float runMinLow = na
if spanH >= 0
for step = 0 to spanH
int idx2 = toIdx2 - step
int rel2 = bar_index - idx2
if rel2 >= 0
float lo2 = low
float hi2 = high
if not na(lo2) and not na(hi2)
runMinLow := na(runMinLow) ? lo2 : math.min(runMinLow, lo2)
bool touches = lo2 <= pocH and hi2 >= pocH
if touches and lo2 == runMinLow
bestIdx2 := idx2
bool gapLeg2 = not na(bestIdx2) ? hasGapBetween(bestIdx2, bosIdx2, true) : false
if not na(bestIdx2) and not gapLeg2
int relBest2 = bar_index - bestIdx2
float top2 = high
float bottom2 = low
if not obOverlapsActive(top2, bottom2)
addObFromPoc(bestIdx2, top2, bottom2, true, totVolH, bullVolH, bearVolH, bosIdx2)
evNewBullOB := true
shPrice := na
shIdx := na
// Invalidation and retest detection for existing OBs.
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec ob = obs.get(i)
if ob.active
bool invalid = false
int invIdx = na
int invTime = na
if ob.isBull
if invMethod == "Wick"
invalid := low < ob.bottom
invIdx := bar_index
invTime := time
else
if bar_index > 0
invalid := close < ob.bottom
invIdx := bar_index - 1
invTime := time
else
if invMethod == "Wick"
invalid := high > ob.top
invIdx := bar_index
invTime := time
else
if bar_index > 0
invalid := close > ob.top
invIdx := bar_index - 1
invTime := time
if invalid
ob.active := false
ob.invalidIndex := invIdx
ob.invalidTime := invTime
bool retestPrev = false
int retestBar = na
int retestTm = na
if bar_index > 0
if ob.isBull
bool opensAbovePrev = open > ob.top
bool closesAbovePrev = close > ob.top
bool wickTouchesPrev = low <= ob.top and low >= ob.bottom
retestPrev := opensAbovePrev and closesAbovePrev and wickTouchesPrev
else
bool opensBelowPrev = open < ob.bottom
bool closesBelowPrev = close < ob.bottom
bool wickTouchesPrev = high >= ob.bottom and high <= ob.top
retestPrev := opensBelowPrev and closesBelowPrev and wickTouchesPrev
if retestPrev
retestBar := bar_index - 1
retestTm := time
if retestPrev and not na(retestBar) and retestBar > ob.createdIndex
ob.retested := true
ob.retestIndex := retestBar
ob.retestTime := retestTm
int lastSideBar = ob.isBull ? lastBullRetestBar : lastBearRetestBar
bool canLog = na(lastSideBar) or retestBar - lastSideBar >= 4
if canLog
obRetests.unshift(RetestRec.new(retestBar, ob.isBull, ob.leftIndex, ob.createdIndex))
if ob.isBull
evBullRetest := true
lastBullRetestBar := retestBar
else
evBearRetest := true
lastBearRetestBar := retestBar
obs.set(i, ob)
//#endregion
//#region DRAW ENGINE (ZONES + VOLUME + 3D)
// Handles all boxes, polylines and labels for OBs and 3D faces.
bool showVD = vdEnable
bool isVert = displayStyle == "Vertical"
bool isHorz = not isVert
float dayAtr = ta.atr(14)
var array allBoxes = array.new()
var array allPolys = array.new()
var array allLabels = array.new()
drawPoly(PolyParams pp) =>
if not na(pp) and not na(pp.points) and pp.points.size() > 0
allPolys.unshift(polyline.new(points = pp.points, line_color = pp.lineColor, fill_color = pp.fillColor))
method pushBox(array store, box b) =>
store.unshift(b)
method pushLabel(array store, label l) =>
store.unshift(l)
// Chooses base colors for OB zones depending on vdEnable and bull/bear type.
obColors(ObRec ob) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
color baseCol = ob.isBull ? bullCol : bearCol
color faded = ob.active ? baseCol : color.new(baseCol, 85)
// Computes right-most bar index for drawing an OB, considering extension and invalidation.
obRightIndex(ObRec ob) =>
int activeRight = bar_index + extendZones
if ob.active
activeRight
else
na(ob.invalidIndex) ? activeRight : ob.invalidIndex
// Draws the main OB zone box on the chart.
drawObZoneBox(ObRec ob, color faded) =>
int xR = obRightIndex(ob)
int xL = ob.leftIndex
int minBar = bar_index - 4999
if xL < minBar
xL := minBar
xR := math.max(xR, xL)
box bx = box.new(left = xL, right = xR, top = ob.top, bottom = ob.bottom, xloc = xloc.bar_index, bgcolor = faded, border_color = na, border_width = 0)
allBoxes.pushBox(bx)
// Draws a retest marker (triangle) when price revisits an OB.
drawRetestLabels(array bullAct, array bearAct, array bullInv, array bearInv) =>
int ret = 0
if showRetestLbl and obRetests.size() > 0
int minBar = bar_index - 4999
int lastBullLbl = na
int lastBearLbl = na
for i = obRetests.size() - 1 to 0
RetestRec r = obRetests.get(i)
if r.barIndex < minBar or r.barIndex > bar_index
RetestRec _trash = obRetests.remove(i)
else
bool hasDisplayedParent = false
if r.isBull
if bullAct.size() > 0
for j = 0 to bullAct.size() - 1
ObRec ob = obs.get(bullAct.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent and not hideInvalid and bullInv.size() > 0
for j = 0 to bullInv.size() - 1
ObRec ob = obs.get(bullInv.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
else
if bearAct.size() > 0
for j = 0 to bearAct.size() - 1
ObRec ob = obs.get(bearAct.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent and not hideInvalid and bearInv.size() > 0
for j = 0 to bearInv.size() - 1
ObRec ob = obs.get(bearInv.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent
continue
int age = bar_index - r.barIndex
if age >= 0 and age <= 4999
if r.isBull
if not na(lastBullLbl) and r.barIndex - lastBullLbl < 3
continue
lastBullLbl := r.barIndex
else
if not na(lastBearLbl) and r.barIndex - lastBearLbl < 3
continue
lastBearLbl := r.barIndex
float yPrice = close
color baseCol = r.isBull ? bullObColor : bearObColor
st = r.isBull ? label.style_triangleup : label.style_triangledown
yl = r.isBull ? yloc.belowbar : yloc.abovebar
label newLbl = label.new(r.barIndex, yPrice, "", xloc = xloc.bar_index, yloc = yl, style = st,
color = color.new(baseCol, 0), textcolor = color.new(baseCol, 0), size = retestSize, force_overlay = true)
allLabels.pushLabel(newLbl)
ret
// Returns geometry used for volume overlay and 3D top view.
obGeom(ObRec ob) =>
int rawL = ob.leftIndex
int rawR = obRightIndex(ob)
int minBar = bar_index - 4999
int xL = math.max(rawL, minBar)
int xR = math.max(rawR, xL)
int widthX = vd3DDepth
int xR2 = xR + widthX
float yT = ob.top
float yB = ob.bottom
float h = yT - yB
// Converts bull/bear percentages into display strings (if enabled).
deltaTexts(float bullPct, float bearPct) =>
string bullTxt = showDeltaPct ? str.tostring(bullPct) + "%" : ""
string bearTxt = showDeltaPct ? str.tostring(bearPct) + "%" : ""
// Draws a text label with total volume on the right-bottom corner of the OB.
drawTotalVolLabel(int xL, int xR, float yT, float yB, float h, float total) =>
if showTotalVol
int cx = xR - 1
if cx < xL
cx := xL
float cy = yB + h * 0.25
string txt = formatVol(total)
label lb = label.new(cx, cy, txt, xloc = xloc.bar_index, style = label.style_label_right,
textcolor = vdTextColor, color = #ffffff00, size = size.small, force_overlay = true)
allLabels.pushLabel(lb)
// Fills the OB with bull/bear split either vertically or horizontally.
drawDeltaFills(int xL, int xR, float yT, float yB, float h, float bullPct, string bullTxt, string bearTxt) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
if isVert
int splitX = xL + int((xR - xL) * (bullPct / 100.0))
splitX := xR - xL >= 2 ? math.max(xL + 1, math.min(xR - 1, splitX)) : xL
box bBull = box.new(xL, yT, splitX, yB, xloc = xloc.bar_index, bgcolor = bullCol, border_width = 0, text = bullTxt, text_color = vdTextColor, text_size = size.small)
box bBear = box.new(splitX, yT, xR, yB, xloc = xloc.bar_index, bgcolor = bearCol, border_width = 0, text = bearTxt, text_color = vdTextColor, text_size = size.small)
allBoxes.pushBox(bBull)
allBoxes.pushBox(bBear)
else
float midY = yB + h * (bullPct / 100.0)
box bBull = box.new(xL, midY, xR, yB, xloc = xloc.bar_index, bgcolor = bullCol, border_width = 0, text = bullTxt, text_color = vdTextColor, text_size = size.small)
box bBear = box.new(xL, yT, xR, midY, xloc = xloc.bar_index, bgcolor = bearCol, border_width = 0, text = bearTxt, text_color = vdTextColor, text_size = size.small)
allBoxes.pushBox(bBull)
allBoxes.pushBox(bBear)
// Track first visible bar index for 3D top face clipping.
var int leftVisIdx = na
if na(leftVisIdx) and time >= chart.left_visible_bar_time
leftVisIdx := bar_index
// Draws the 3D front faces and top faces based on bull/bear split and style.
drawDelta3D(int xL, int xR, int widthX, int xR2, float yT, float yB, float h, float bullPct) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
float depthY = dayAtr * (0.1 * vd3DDepth)
int visibleLeft = na(leftVisIdx) ? xL : math.max(xL, leftVisIdx)
int visibleRight = xR
if isHorz
float midY = yB + h * (bullPct / 100.0)
if bullPct > 0
array ptsFrontBull = array.new()
ptsFrontBull.sideBox(xR, yB, midY, depthY, widthX)
drawPoly(PolyParams.new(ptsFrontBull, color.new(chart.fg_color, 90), color.new(bullCol, 70), 1))
if bullPct < 100
array ptsFrontBear = array.new()
ptsFrontBear.sideBox(xR, midY, yT, depthY, widthX)
drawPoly(PolyParams.new(ptsFrontBear, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
if visibleRight > visibleLeft
array ptsTop = array.new()
ptsTop.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
ptsTop.unshift(chart.point.from_index(visibleLeft + widthX, yT + depthY))
ptsTop.unshift(chart.point.from_index(visibleLeft, yT))
ptsTop.unshift(chart.point.from_index(visibleRight, yT))
ptsTop.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTop, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
else
array ptsFront = array.new()
ptsFront.sideBox(xR, yB, yT, depthY, widthX)
drawPoly(PolyParams.new(ptsFront, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
if visibleRight > visibleLeft
float frac = bullPct / 100.0
int bullRight = visibleLeft + int((visibleRight - visibleLeft) * frac)
bullRight := math.max(visibleLeft, math.min(visibleRight, bullRight))
if bullPct > 0 and bullRight > visibleLeft
array ptsTopBull = array.new()
ptsTopBull.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
ptsTopBull.unshift(chart.point.from_index(visibleLeft + widthX, yT + depthY))
ptsTopBull.unshift(chart.point.from_index(visibleLeft, yT))
ptsTopBull.unshift(chart.point.from_index(bullRight, yT))
ptsTopBull.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTopBull, color.new(chart.fg_color, 90), color.new(bullCol, 70), 1))
if bullPct < 100 and visibleRight > bullRight
array ptsTopBear = array.new()
ptsTopBear.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
ptsTopBear.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
ptsTopBear.unshift(chart.point.from_index(bullRight, yT))
ptsTopBear.unshift(chart.point.from_index(visibleRight, yT))
ptsTopBear.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTopBear, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
// Draws a full OB: zone, retest label, volume fill and 3D faces.
drawZoneAndVolume(ObRec ob) =>
= obColors(ob)
drawObZoneBox(ob, faded)
if showVD and ob.hasDelta
= obGeom(ob)
= deltaTexts(ob.bullPct, ob.bearPct)
drawTotalVolLabel(xL, xR, yT, yB, h, ob.totalVol)
drawDeltaFills(xL, xR, yT, yB, h, ob.bullPct, bullTxt, bearTxt)
if vd3D
drawDelta3D(xL, xR, widthX, xR2, yT, yB, h, ob.bullPct)
true
// Clear all previous drawings each bar before re-rendering current selection.
allBoxes.clearAll(allPolys, allLabels)
// Pick active and invalid OBs based on hideInvalid + showNearestX.
array bullActive = array.new_int()
array bearActive = array.new_int()
array bullInvalid = array.new_int()
array bearInvalid = array.new_int()
if hideInvalid
bullActive := pickNearest(obs, true, showNearestX, false)
bearActive := pickNearest(obs, false, showNearestX, false)
else
bullActive := pickNearest(obs, true, showNearestX, false)
bearActive := pickNearest(obs, false, showNearestX, false)
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec o = obs.get(i)
if not o.active
if o.isBull
bullInvalid.push(i)
else
bearInvalid.push(i)
if bearInvalid.size() > 0 and not hideInvalid
for i = 0 to bearInvalid.size() - 1
ObRec ob = obs.get(bearInvalid.get(i))
drawZoneAndVolume(ob)
if bearActive.size() > 0
for i = 0 to bearActive.size() - 1
ObRec ob = obs.get(bearActive.get(i))
drawZoneAndVolume(ob)
if bullInvalid.size() > 0 and not hideInvalid
for i = 0 to bullInvalid.size() - 1
ObRec ob = obs.get(bullInvalid.get(i))
drawZoneAndVolume(ob)
if bullActive.size() > 0
for i = 0 to bullActive.size() - 1
ObRec ob = obs.get(bullActive.get(i))
drawZoneAndVolume(ob)
// Draw all stored retest events on top of zones
drawRetestLabels(bullActive, bearActive, bullInvalid, bearInvalid)
//#endregion
//#region ALERTS
alertcondition(alBullOB and evNewBullOB, "Bullish Order Block", "New Bullish Order Block detected.")
alertcondition(alBearOB and evNewBearOB, "Bearish Order Block", "Bearish Order Block detected.")
alertcondition(alBullRetest and evBullRetest, "Bullish OB Retest", "Bullish Order Block retest.")
alertcondition(alBearRetest and evBearRetest, "Bearish OB Retest", "Bearish Order Block retest.")
if alBullOB and evNewBullOB
alert("Bullish Order Block detected.", alert.freq_once_per_bar)
if alBearOB and evNewBearOB
alert("Bearish Order Block detected.", alert.freq_once_per_bar)
if alBullRetest and evBullRetest
alert("Bullish Order Block retest.", alert.freq_once_per_bar)
if alBearRetest and evBearRetest
alert("Bearish Order Block retest.", alert.freq_once_per_bar)
// ==========================================================================================
// === Dashboard with Telegram Link ===
var table myTable = table.new(position.top_center, 1, 1, border_width=1, frame_color=color.black, bgcolor=color.white)
// Add Telegram Message to Dashboard
table.cell(myTable, 0, 0, "Join Telegram @STRATEGY INDIBOT", bgcolor=color.blue, text_color=color.white, text_size=size.normal)
Magnitude of Price DiscoveryThis script is a simple attempt to show the magnitude of price discovery
Before we discuss how it works we need to discuss our terms.
Universal Truth of Price #1 - Price only trades in 3 distinct ways
Scenario 1 - Inside bar to previous range, consolidation.
Scenario 2 - Trending bar up or down, HH + HL to previous bar or LL + LH to previous bar
Scenario 3 - Outside bar, Higher highs AND lower lows to previous bar. Also known as a broadening formation.
If you are interested in the 2nd universal truth my indicator 'Timeframe Continuity Bars' discusses it there.
Given one of the 3 scenarios price can trade in is a broadening formation it proves that price discovery occurs as a series of new highs and new lows.
Notice the scenario 3 marked by SimpleStratNumbers
This scenario 3 is a broadening formation on the 1min and on the 30min basis.
Given this is true we know if price rejects the broadening highs it is attempting to make new lows to the broadening range
So, what this indicator does is it uses previous swing highs and swing lows and it shows you when price reclaims them and gives you a target.
The target of this indicator is guaranteed to be hit if the 2nd universal truth of price is in your favor.
This means if we reclaim a previous high to the downside. At the time of all known participation groups selling we know the magnitude of this selling would be the other side of the range
So it's simple, the solid line shows you the reclaimed level.
The dotted line shows you the magnitude.
Full timeframe continuity tells you when it is FOR SURE going to your target price via MTF analysis of the aggressiveness of the buyers/sellers.
However timeframe continuity is subject to change every 60min, every day, every week, and every month! That's the risk you take when trading.
Here's one example for you.
NASDAQ:AAPL monthly made a new low and changed to green this was your evidence price is attempting to take the other side of the range.
NASDAQ:AAPL monthly opened green again and re-confirmed the upside which meant the other side
of the range was still for certain going to be taken out.
After being taken out, breakout traders buy the highs and any shorts in aapl are forced to cover.
BOOM!
This indicator is likely to be updated in the near future to align entries on multiple timeframes.
Nothing spoken here is financial advice and it is ONLY what we know to be true about price action.
Order Blocks & Breaker Blocks Destek DirencOrder Blocks & Breaker Blocks Destek Direnc Al Sat Bölgeleri
Pro Cumulative Volume RSI# Pro Cumulative Volume RSI - Professional Trading Indicator
## 📊 What is it?
The **Pro Cumulative Volume RSI** is an advanced momentum oscillator that analyzes buying and selling pressure through volume distribution. Unlike traditional RSI that only tracks price movements, this indicator separates volume into buying and selling components, providing two distinct RSI calculations that reveal market dynamics from both perspectives.
## 🔍 How Does It Work?
### Volume Distribution Algorithm
The indicator uses a sophisticated volume distribution method:
**Buying Volume (BV)** = Volume × (Close - Low) / (High - Low)
**Selling Volume (SV)** = Volume × (High - Close) / (High - Low)
This formula proportionally allocates volume based on where the candle closes within its range:
- If close is near the high → More buying volume
- If close is near the low → More selling volume
### Dual RSI Calculation
The indicator then calculates **two separate RSI values**:
1. **Green Line (Buying Volume RSI)**: Measures the dominance of buying pressure
2. **Red Line (Selling Volume RSI)**: Measures the dominance of selling pressure
Each RSI follows the traditional 14-period calculation but applies it to the volume pressure differences rather than price changes.
## 🎯 How to Use It
### Signal Interpretation
| Scenario | Meaning | Action |
|----------|---------|--------|
| Green > 70, Red < 30 | Strong buying dominance | Consider buying / Hold long |
| Red > 70, Green < 30 | Strong selling dominance | Consider selling / Avoid longs |
| Green crosses above Red | Momentum shift to buyers | Potential buy signal |
| Red crosses above Green | Momentum shift to sellers | Potential sell signal |
| Both near 50 | Balanced market | Wait for confirmation |
### Key Features
**1. Crossover Signals**
- **BUY signal**: When green line crosses above red line with sufficient momentum
- **SELL signal**: When red line crosses above green line with sufficient momentum
- Triangle markers appear automatically on the chart
**2. Divergence Detection**
- **Bullish Divergence (DIV+)**: Price makes lower lows but indicator makes higher lows → Potential reversal up
- **Bearish Divergence (DIV-)**: Price makes higher highs but indicator makes lower highs → Potential reversal down
- Yellow/orange circles mark divergences automatically
**3. Background Coloring**
- **Green background**: Buying pressure dominates
- **Red background**: Selling pressure dominates
- Intensity shows strength of pressure
**4. Live Status Table**
- Real-time RSI values for both buying and selling
- Current momentum status
- Market pressure assessment
- Last detected signal
### Settings Customization
**Basic Settings:**
- **RSI Period**: Default 14, adjust based on your trading timeframe (shorter = more sensitive)
**Visual Settings:**
- **Histogram Mode**: Toggle between line and histogram display
- **Background Coloring**: Enable/disable pressure-based background
- **Transparency**: Adjust background opacity
**Signal Settings:**
- **Crossover Signals**: Show/hide BUY/SELL markers
- **Divergence Detection**: Enable automatic divergence spotting
- **Sensitivity**: Low/Medium/High - controls how strong momentum must be for signals
**Level Lines:**
- **Overbought/Oversold**: Adjust threshold levels (default 70/30)
## ⚠️ IMPORTANT DISCLAIMER
### This Indicator Should NOT Be Used Alone
**ALWAYS combine this indicator with other forms of analysis:**
✅ **Price Action Analysis**
- Support and resistance levels
- Trend lines and chart patterns
- Candlestick formations
✅ **Other Technical Indicators**
- Moving Averages (trend confirmation)
- MACD (momentum confirmation)
- Volume Profile (context)
- ATR (volatility assessment)
- Bollinger Bands (volatility and extremes)
✅ **Multiple Timeframe Analysis**
- Check higher timeframes for overall trend
- Use lower timeframes for precise entries
- Ensure signals align across timeframes
✅ **Fundamental Analysis**
- News and economic events
- Earnings reports (for stocks)
- Market sentiment
- Macro conditions
✅ **Risk Management**
- **NEVER** risk more than 1-2% per trade
- Always use stop losses
- Calculate position size before entering
- Have a clear exit strategy
### Common Pitfalls to Avoid
❌ **Don't** take every signal blindly
❌ **Don't** ignore the overall market trend
❌ **Don't** trade against strong momentum without confirmation
❌ **Don't** forget about major support/resistance levels
❌ **Don't** over-leverage based on indicator signals
❌ **Don't** ignore fundamental catalysts
### Best Practices
✅ **Wait for confluence**: Multiple indicators agreeing
✅ **Consider market context**: Bull/bear market conditions
✅ **Use appropriate timeframes**: Match your trading style
✅ **Backtest first**: Test on historical data before live trading
✅ **Keep a trading journal**: Track what works and what doesn't
✅ **Respect your risk management rules**: Always
## 📈 Example Trading Scenarios
### Scenario 1: Strong Trend Following
- **Setup**: Green RSI consistently above 50, price in uptrend
- **Confirmation**: Higher timeframe trend is up, price above major MA
- **Entry**: BUY signal on pullback when green crosses red
- **Stop Loss**: Below recent swing low
- **Exit**: When red RSI crosses above green or divergence appears
### Scenario 2: Reversal Trading
- **Setup**: Bullish divergence (DIV+) appears at support level
- **Confirmation**: Price shows bullish candlestick pattern, other oscillators oversold
- **Entry**: After confirmation candle closes
- **Stop Loss**: Below divergence low
- **Exit**: At resistance or when momentum weakens
### Scenario 3: Avoiding False Signals
- **Signal**: BUY signal appears
- **Check**: Price is at strong resistance, higher timeframe shows downtrend
- **Action**: **SKIP the trade** - context overrides signal
- **Result**: Protected capital by avoiding low-probability setup
## 🎓 Educational Use
This indicator is designed to help traders:
- Understand volume-based momentum
- Identify shifts in market pressure
- Learn about divergence patterns
- Practice multi-indicator analysis
**Remember**: No indicator is perfect. Markets are complex and influenced by countless factors. Use this tool as one piece of your trading puzzle, not as a standalone solution.
## 📞 Support & Updates
- Report bugs or suggest features via comments
- Check back for updates and improvements
- Share your successful setups to help the community learn
## ⚖️ Legal Disclaimer
**This indicator is for educational and informational purposes only.**
- Not financial advice
- Past performance does not guarantee future results
- Trading involves substantial risk of loss
- Only trade with money you can afford to lose
- Consult with a licensed financial advisor before making investment decisions
**The creator of this indicator assumes no responsibility for trading losses incurred through its use.**
---
## 🚀 Happy Trading!
Remember: **Patience, discipline, and proper risk management** are more important than any indicator. Trade smart, trade safe!
*If you find this indicator helpful, please leave a comment and share your experience!*
Quantum Regression Oscillator [ICN]The Problem: The Lag of Standard Oscillators
Most traders rely on the Relative Strength Index (RSI) or MACD to gauge momentum. While these are legendary tools, they suffer from a critical flaw: Lag. They calculate what has happened, often giving signals after the move is already halfway done.
The Quantum Regression Oscillator (QRO) was built to solve this. It is not a simple average; it is a predictive engine.
The "Quantum" Math (How It Works)
Instead of using standard smoothing (like SMA or EMA) which drags data backward, the QRO uses Linear Regression Analysis on the RSI data itself.
Linear Regression Core : The script calculates the "Line of Best Fit" for momentum in real-time. This allows the oscillator to react to price changes faster than price itself in some instances, effectively "predicting" the next tick of momentum.
Dynamic Volatility Bands : Unlike fixed bands (e.g., 70/30 on RSI), the QRO uses standard deviation bands that expand and contract with market volatility. This means "Overbought" is not a fixed number—it adapts to the market's energy.
Visual Guide : Reading the Oscillator
1. The Quantum Line (The Main Curve)
What it is : The smooth, fast-moving line oscillating between 0 and 100.
How to read it:
Crossing Midline (50) : The baseline for trend. Above 50 is Bullish Momentum; Below 50 is Bearish Momentum.
Slope : Because it uses regression, the angle of the line is a signal itself. A sharp turn often precedes price action.
2. The Dynamic Bands (The Shaded Zones)
What they are: The Blue (Lower) and Red (Upper) zones.
How to read it:
Oversold (Blue Zone) : When the line enters the Blue zone, price is statistically overextended to the downside. This is a "Sniper Buy" zone.
Overbought (Red Zone) : When the line enters the Red zone, price is statistically overextended to the upside. This is a "Sniper Sell" zone.
3. Divergence Detection
The QRO is excellent at spotting divergences. If Price makes a Higher High but the QRO makes a Lower High (while in the Red Zone), a reversal is mathematically probable.
Integration with the ICN Suite
While this oscillator is powerful as a standalone tool, it is the "Engine" behind the Institutional Confluence Nexus .
Standalone : Use it to spot divergences and momentum shifts with zero lag.
With ICN : The main chart indicator reads data from this oscillator to generate "Sniper" and "Pullback" signals automatically.
Settings & Customization
QRO Length: The lookback period for the base RSI calculation.
Regression Length: The sensitivity of the linear regression curve (Lower = Faster/More Noise, Higher = Smoother/More Lag).
Smoothing: Additional filtering to remove market noise.
For Developers (Open Source)
I believe in the power of open-source education. Developers can view the source code to learn:
How to implement ta.linreg (Linear Regression) on top of other indicators.
How to create dynamic bands using ta.stdev (Standard Deviation).
How to create smooth color gradients using plot transparency.
Disclaimer:
This tool is a mathematical aid for technical analysis. It does not predict the future. Always use proper risk management.






















