CVD Complete Volume Analysis ProCVD Complete Volume Analysis Pro | Order Flow & Absorption
Introduction:
In the world of modern trading, Price is the advertisement, but Volume is the fuel. However, standard volume indicators on TradingView are often insufficient. They tell you how much was traded, but they don’t tell you how it was traded.
Was that large volume spike aggressive buying driving the trend? or was it a "buying frenzy" hitting a wall of passive limit orders (absorption)?
The CVD Complete Volume Analysis Pro (v5) is an advanced institutional-grade Order Flow engine. By utilizing 1-second intrabar data, this indicator reconstructs the "Tick Rule" to separate Aggressive (Market) orders from Passive (Limit) orders. It calculates Cumulative Volume Delta (CVD), detects Absorption/Distribution anomalies, and utilizes an embedded Logistic Regression model to predict daily directional bias.
This is not just an indicator; it is a complete Order Flow Dashboard designed to aid and support complex footprint charts for the everyday trader.
🏗️ How It Works: The "Micro-Structure" Engine
Most volume indicators on TradingView look at the close of a 1-minute or 5-minute bar to guess the volume direction. This script goes deeper.
1. The 1-Second Granularity
Using TradingView's request.security_lower_tf capability, this script pulls 1-second resolution data regardless of the chart timeframe you are on.
It analyzes the price movement every second.
It applies the "Tick Rule": If price moves up, volume is classified as Buy. If price moves down, volume is classified as Sell.
This allows for a highly accurate reconstruction of Buying vs. Selling pressure that standard indicators miss.
2. The "Cluster" Concept
The script aggregates these 1-second data points into Clusters.
Default: 60 seconds (1 minute) per cluster.
This creates a normalized "Heartbeat" of the market, allowing us to compare the efficiency of volume over fixed time windows, removing the noise of time-based chart distortions.
3. The "Passive" Detection Logic (The Core Feature)
This is the most powerful aspect of the tool. It calculates the relationship between Effort (CVD) and Result (Price Move).
The Baseline: The script calculates a rolling statistical baseline (Standard Deviation) of how much price should move for a given amount of Delta.
Absorption (Hidden Buying): If we see massive Aggressive Selling (Negative CVD) but price refuses to drop (or drops significantly less than the statistical model predicts), the script identifies this as Passive Buying.
Distribution (Hidden Selling): If we see massive Aggressive Buying (Positive CVD) but price refuses to rise, the script identifies this as Passive Selling.
📊 The Dashboard Breakdown
The on-screen dashboard is your command center. It updates in real-time to provide a snapshot of the market's internal mechanics.
Section 1: Flow Analysis
This section analyzes the current session's behavior.
Flow Type: Categorizes the market state using algorithmic logic.
Aggressive Buying/Selling: The market is trending, and aggressive participants are winning.
Strong Accumulation/Distribution: A reversal signal. Aggressive participants are trapped, and passive whales are absorbing order flow.
Flow vs. Price: Detects divergences instantly.
Bullish Divergence: Net Flow is Positive, but Price is down (indicates manipulation or temporary suppression).
Bearish Divergence: Net Flow is Negative, but Price is up (indicates a "trap" move).
Section 2: Volume Breakdown
A detailed ledger of the day's activity.
Aggressive Buy/Sell: Market orders executing at the ask/bid. This represents "Impatience."
Passive Buy/Sell: The estimated volume of Limit Orders absorbing the aggressive flow. This represents "Intent."
Net Flow: The mathematical sum of all buy pressure minus sell pressure.
Section 3: Net Positioning (Multi-Day)
Markets don't happen in a vacuum. This section looks back (default 5 days) to see the accumulated inventory.
Bias: Are we in a multi-day accumulation or distribution phase?
Activity Type:
High Hidden Activity: Indicates a fighting market with heavy limit orders (choppy/reversal prone).
Mostly Aggressive: Indicates a trending market with low resistance.
Section 4: Predictive Model (Machine Learning)
The script features an embedded Logistic Regression Model.
It trains on the last N days of Flow Data (CVD, Net Aggressive, Net Passive, Passive Ratios).
It outputs a Probability Score (0% to 100%) regarding the likelihood of an UP close for the current session.
Note: This is a probability model based on order flow history, not a guarantee. Use it as a bias confirmation tool.
🧠 Educational: How to Trade With This
Strategy 1: The "Absorption" Reversal
Context: Price hits a major resistance level.
Look at the Dashboard: You want to see "Flow Type" switch to "Strong Distribution".
The Logic: Price is rising, and aggressive buyers are hitting the ask. However, the script detects that for every buy order, a passive seller is absorbing it. Price stops moving up despite high volume.
The Trigger: When Price creates a lower low on the chart while the dashboard shows Distribution, this is a high-probability short entry.
Strategy 2: The Flow Divergence
Context: Price is trending down.
Look at the Dashboard: Price is making new lows, but the "Net Flow" is turning Green (Positive), or the "Cum CVD" is sloping upwards.
The Logic: This is "Effort vs. Result." Sellers are exhausted. They are pushing price down, but the net flow is shifting to buyers.
The Trigger: Enter Long on the first structure break.
Strategy 3: Trend Continuation
Context: Market is opening or breaking a range.
Look at the Dashboard: You want "Full Alignment."
Signals: "Flow Type" says Aggressive Buying, Net Flow is Positive, and the Predictive Model shows >60% Bullish Probability.
The Logic: There is no passive resistance. Aggressive buyers are pushing price up freely.
The Trigger: Buy pullbacks.
⚙️ Settings & Configuration
Cluster Size: The number of 1-second bars to group together.
Use 60 (1 min) for Scalping.
Use 300 (5 min) for Day Trading.
Average Length: The baseline for statistical calculations. Higher numbers = smoother baselines but slower adaptation.
Detection Settings:
Passive Multiplier: Adjusts the sensitivity of the absorption estimation. 1.0 is standard. Increase to 1.5 if you only want to see extreme anomalies.
Daily Tracking:
History Days: How many days of data to display in the table. Note: Due to TradingView data limits, keeping this between 3-5 days ensures the most stability.
⚠️ Important Technical Limitations
Please read this section carefully to understand the constraints of the Pine Script environment:
Data Depth (The 100k Limit): TradingView limits request.security_lower_tf to approximately 100,000 intrabars.
This means the script can typically only "see" the last 3 to 5 days of true 1-second data.
If you set History Days or Training Days too high (e.g., 20 days), the script may return 0 values for older dates because the high-resolution data simply doesn't exist on the server.
Approximation of Ticks: While 1-second data is extremely precise, it is still an aggregation. In extremely high-volatility events (like CPI releases), multiple ticks happen inside one second. The script attributes the volume of that second based on the close relative to the open/prev close. It is the best approximation possible on TradingView, but not a replacement for Level 3 Tick Data feeds.
Calculation Time: This is a heavy script. On lower-end devices or when loading on many charts simultaneously, you may experience a "Calculation took too long" warning. If this happens, reduce the History Days to 3.
🛡️ Disclaimer
No Repainting: This indicator uses strict historical referencing and does not repaint closed clusters.
Not Financial Advice: This tool provides data visualization. Order flow is a subjective art. Always manage your risk.
Author's Note:
I built this tool because I wanted the power of Order Flow footprint charts without the visual clutter. By using statistical baselines to detect passive liquidity, we can finally see the "invisible hand" of the market directly on our TradingView charts. I hope this adds value to your trading.
👍 If you find this script useful, please leave a Boost and a Comment below!
Statistics
SA Trump Volatility Pattern Wick + Volume Shock ReversalDisclaimer (read first)
Educational use only — not financial advice. This script does not provide entries/exits, targets, position sizing, or profit guarantees. Trading (especially options/futures) involves substantial risk and can result in loss of principal (and more for leveraged products). Use at your own discretion.
Best use cases on the 2-Hour timeframe
On 2H, this script becomes a high-signal-quality “shock reversal” detector instead of a noisy candle toy. You’re essentially filtering for:
Large wick rejection
Small real body
Statistically unusual volume (Z-score > threshold)
Context alignment (trend filter + prior bar direction + optional RSI)
What 2H is best for
1) Detecting “event shock” reversals
2H bars often capture:
Macro headlines
Fed commentary
earnings reactions (for equities)
sudden volatility expansions
When the script fires on 2H, it often means:
“Aggressive push happened, liquidity got rejected, and participation was unusually high.”
That’s a structural clue, not a trade instruction.
2) Filtering false breakouts / breakdowns
The wick requirement is basically “failed continuation.”
On 2H, this is powerful around:
prior day highs/lows
weekly pivots
obvious consolidation edges
key moving averages (fast SMA / slow SMA gate)
Bull pattern = flush + reclaim behavior.
Bear pattern = pop + rejection behavior.
3) Options traders: timing “premium exposure windows”
On 2H, this is great for options traders who want to avoid buying premium into a fake move.
BullTrump on 2H can be used as a “don’t chase puts / be cautious short” context shift.
BearTrump on 2H can be used as a “don’t chase calls / be cautious long” context shift.
It’s a “regime hint” for the next few sessions, not a one-bar command.
4) Futures traders: rotation vs continuation framework
A 2H “Trump Candle” often marks:
the end of a liquidation leg
a stop-run / squeeze peak
a pivot moment where the market shifts from impulse to balance
Use it to decide whether you’re in:
continuation mode (trend carries)
or rotation mode (mean-reversion / two-way)
How to use it (2H workflow)
Step A — Keep it strict at first
Recommended defaults for 2H:
wickFracThreshold: 0.40–0.55
bodyMaxFrac: 0.35–0.45
volZThresh: 1.0–1.5
useRSIFilter: ON
RSI bull min / bear max: 45 / 55 (good baseline)
Step B — Treat triggers as “context events”
When it prints, ask 3 questions:
Where did it happen? (key level or random spot)
Was it aligned with trend gate? (SMA fast/slow)
Did volume Z-score spike? (true shock vs normal wick)
Higher quality triggers happen when:
the wick pierces a known level (prior swing / range edge)
and the close re-enters the range
and volume Z-score is meaningfully positive
Step C — Confirm with the next 1–2 candles (optional)
On 2H, it’s reasonable to wait for:
a follow-through close
or a hold above/below fast SMA
or a second “acceptance” candle
You can do this manually without changing code.
Other recommended timeframes (best to worst)
✅ 4H (even cleaner, fewer signals)
Use for:
swing context
multi-day pivots
big reversal points
✅ 1H (more signals, still structured)
Use for:
intraday + overnight context
day-trade bias shifts
✅ 30m (for active traders)
Use for:
tighter responsiveness
more setups
But requires more discretion; noise increases.
⚠️ 15m and below (only if you increase strictness)
If you want to run it on 5m/15m:
raise volZThresh (ex: 1.5–2.0)
raise wickFracThreshold (ex: 0.50–0.65)
lower bodyMaxFrac (ex: 0.25–0.35)
Otherwise it will trigger too often.
Best markets for this script
Works best on:
Index futures: /NQ, /ES (big volume makes Z-score meaningful)
Liquid ETFs: SPY, QQQ
High-volume large caps (AAPL, MSFT, NVDA etc.)
Less reliable on:
thin small caps (volume Z-score gets weird)
low-volume premarket candles
illiquid options underlyings
Signal Inside the Script ✅ SA ZoneEngine Bias Filtered is a market-structure bias and confirmation tool designed for futures To request access: 👉 Purchase here: trianchor.gumroad.com
Best GBT for this indicator
chatgpt.com
chatgpt.com
chatgpt.com
Range Breakout Statistics [Honestcowboy]⯁ Overview
The Range Breakout Statistics uses a very simple system to detect ranges/consolidating markets. The principle is simple, it looks for areas where the slope of a moving average is flat compared to past values. If the moving average is flat for X amount of bars that's a range and it will draw a box.
The statistics part of the script is a bit more complicated. The aim of this script is to expand analysis of trading signals in a different way than a regular backtest. It also highlights the polyline tool, one of my favorite drawing tools on the tradingview platform.
⯁ Statistics Methods
The script has 2 different modes of analyzing a trading signals strength/robustness. It will do that for 2 signals native to the script.
Upper breakout: first price breakout at top of box, before max bars (100 bars by default)
Lower breakout: first price breakout at bottom of box, before max bars
The analysis methods themselves are straightforward and it should be possible for tradingview community to expand this type of analysis to other trading signals. This script is a demo for this analysis, yet some might still find the native signals helpful in their trading, that's why the script includes alerts for the 2 native signals. I've also added a setting to disable any data gathering, which makes script run faster if you want to automate it.
For both of the analysis methods it uses the same data, just with different calculations and drawing methods. The data set is all past price action reactions to the signals saved in a matrix. Below a chart for explaining this visually.
⯁ Method 1: Averages Projection
The idea behind this is that just showing all price action that happened after signal does not give actionable insights. It's more a spaghetti jumble mess of price action lines. So instead the script averages the data out using 3 different approaches, all selectable in the settings menu.
Geometric Average: useful as it accurately reflects compound returns over time, smoothing out the impact of large gains or losses. Accounts for volatility drift.
Arithmetic Average: a standard average calculation, can be misleading in trading due to volatility drift. It is the most basic form of averaging so I included it.
Median: useful as any big volatility huge moves after a signal does not really impact the mean as it's just the middle value of all values.
These averages are the 2 lines you will find in the middle of the projection. Having a clear difference between a lower break average and upper break average price reaction can signal significance of the trading signal instead of pure chaos.
Outside of this I also included calculations for the maximum and minimum values in the dataset. This is useful for seeing price reactions range to the signal, showing extreme losses or wins are possible. For this range I also included 2 matrices of highs and lows data. This makes it possible to draw a band between the range based on closing price and the one using high/low data.
Below is a visualisation of how the averages data is shown on chart.
⯁ Method 2: Equity Simulation
This method will feel closer to home for traders as it more closely resembles a backtest. It does not include any commissions however and also is just a visualisation of price reaction to a signal. This method will simulate what would happen if you would buy at the breakout point and hold the trade for X amount of bars. With 0 being sell at same bar close. To test robustness I've given the option to visualise Equity simulation not just for 1 simulation but a bunch of simulations.
On default settings it will draw the simulations for 0 bars holding all the way to 10 bars holding. The idea behind it is to check how stable the effect is, to have further confirmation of the significance of the signal. If price simulation line moves up on average for 0 bars all the way to 10 bars holding time that means the signal is steady.
Below is a visualisation of the Equity Simulation.
⯁ Signal filtering
For the boxes themselves where breakouts come from I've included a simple filter based on the size of the box in ATR or %. This will filter out all the boxes that are larger top to bottom than the ATR or % value you setup.
⯁ Coloring of Script
The script includes 5 color themes. There are no color settings or other visual settings in the script, the script themes are simple and always have colors that work well together. Equity simulation uses a gradient based on lightness to color the different lines so it's easier to differentiate them while still upper breaks having a different color than lower breaks.
This script is not created to be used in conjunction with other scripts, it will force you into a background color that matches the theme. It's purpose is a research tool for systematic trading, to analyse signals in more depth.
Metaverse color theme:
⯁ Conclusion
I hope this script will help traders get a deeper understanding of how different assets react to their assets. It should be possible to convert this script into other signals if you know how to code on the platform. It is my intention to make more publications that include this type of analysis. It is especially useful when dealing with signals that do not happen often enough, so a regular backtest is not enough to test their significance.
Percentage Price LevelsPercentage Price Levels displays dynamic price levels based on percentage gains and losses from the current price. Instantly visualize where price would be at ±2%, ±4%, ±6%, ±8%, ±10%(and beyond) — perfect for setting profit targets, stop-losses, and understanding potential price movement.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IT DOES
• Draws horizontal lines at percentage-based price levels above and below current price
• Green lines = potential profit targets (positive %)
• Red lines = potential stop-loss zones (negative %)
• Yellow line = current price reference
• Summary table shows all levels in a clean, easy-to-read format
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ FEATURES
• Up to 8 positive and 8 negative percentage levels
• Fully customizable percentages (set your own values)
• Toggle each level on/off individually
• Adjustable font size (Tiny to Huge)
• Multiple line styles (Solid, Dashed, Dotted)
• Movable summary table (any corner)
• Base price options: Close, Open, High, Low, HL2, OHLC4
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 HOW TO USE
1. Add the indicator to your chart
2. Default shows ±2%, ±4%, ±6%, ±8%, ±10% levels
3. Open Settings to customize:
• Enable/disable specific levels
• Change percentage values
• Adjust colors and font size
• Move table position
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 USE CASES
• Day Trading — Quick intraday profit targets
• Swing Trading — Visualize multi-day price zones
• Risk Management — Set stop-losses based on % risk tolerance
• Options Trading — Find strike prices relative to spot
• Position Sizing — See exact dollar values at each level
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 DEFAULT SETTINGS
Positive: +2%, +4%, +6%, +8%, +10% (3 extra slots available)
Negative: -2%, -4%, -6%, -8%, -10% (3 extra slots available)
Font Size: Normal
Line Style: Dashed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
If you find this useful, please leave a like! Feedback and suggestions welcome in the comments.
First Candle com TargetsThis Pine Script implements a "First Candle of the Day" breakout strategy with targets:
Strategy Logic:
Identifies the first hourly candle of each trading day
Calculates the high, low, and range (distance) of that candle
Draws four horizontal levels on the chart:
High level (red solid line)
Low level (green solid line)
Buy target (blue dashed): High + Daily Range
Sell target (purple dashed): Low - Daily Range
Generates signals when price breaks above/below these levels:
BUY signal: When price closes ABOVE the Buy target (High + Range)
SELL signal: When price closes BELOW the Sell target (Low - Range)
Visualizes all levels with labels showing exact price values
Key Features:
Uses 1-hour timeframe
Lines extend 500 bars forward from the first candle
Automatic cleanup and update of levels each new day
Includes alert conditions for automated trading notifications
Marks the first candle of each day with a blue label
Trading Approach:
Breakout long when price exceeds the first candle's high by its full daily range
Breakout short when price falls below the first candle's low by its full daily range
The strategy assumes the first candle's range establishes intraday volatility boundaries
Futures Risk Manager (Futures)Risk management table for consistency trading.
Auto adjustable for MINI/MICRO based on your account.
can change RR shows SL and TP and amount to enter.
Please take note that you need to update every trade the stop tick and RR ratio.
Good luck in your trading journey.
TheStrat MasterThe Strat refers to a trading strategy that simplifies market analysis by focusing on price action and candlestick patterns. Here are some key points about The Strat:
Candlestick Patterns: The Strat categorizes price bars into Inside Bars, Directional Bars, and Outside Bars, which help traders identify potential trading opportunities.
1
Simple Rules: It emphasizes three main components: price action, direction, and time frame alignment, making it accessible for both new and experienced traders.
1
Decision-Making: The Strat provides a framework for making decisions based on price movements, reducing emotional trading and improving accuracy.
1
Educational Resources: There are various resources available, including cheat sheets and mentorship programs, to help traders learn and apply The Strat effectively.
1
For more detailed information, you can explore the resources provided in the results.
GOLD QUANTUM MASTER🥇 GOLD QUANTUM MASTER 🥇
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
A high-performance technical analysis suite engineered for institutional-grade precision on Gold (XAUUSD) and Bitcoin (BTCUSD). This Core Edition focuses on raw analytical power without external API overhead.
🚀 KEY FEATURES:
• INSTITUTIONAL FOOTPRINT: Advanced volume-to-MA filters to identify "Big Money" participation.
• HTF REVERSAL SCANNER: Specialized logic for 30m, 1H, and 4H charts to detect Pinbar and Engulfing reversals.
• LIQUIDITY FLOW ANALYTICS: Detects and highlights Previous Day High (PDH) and Low (PDL) sweeps.
• TREND EXHAUSTION FILTERS: Built-in RSI divergence logic to prevent entries at trend peaks or bottoms.
• PREMIUM DATA LABELS: Real-time on-chart display of Signal Mode, Quality Score, and dynamic targets.
• NEON VISUAL SYSTEM: High-contrast, glassmorphic layout for maximum clarity during trading sessions.
BEST FOR: Technical Analysts, Manual Traders, and High-Performance Charting.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The best work on Higher time frames, I still not tested on lower time frames, but should be also precise.
Feel free to adjust the settings to your own needs.
Make your own decisions when you trade, do not put all confidence into a script, it may fail also.
Fifty Two Week Highs and Lows Displays 52-week highs and lows with percentage distance context, optional dashboard, and visual connections between successive new highs for long-term range awareness.
Fifty Two Week Highs and Lows
This indicator provides clear, objective context around price location within its 52-week range. It is designed to help users quickly assess how extended or compressed price is relative to its long-term highs and lows, without generating trade signals or placing orders.
What the indicator does
Calculates 52-week highs and lows using one of two reference definitions:
Daily (252 bars): Rolling high and low over a configurable number of daily bars, best suited for Daily charts.
Weekly (52 weeks): True weekly 52-week high and low values projected onto the active chart timeframe.
Displays a compact dashboard showing:
Percent below the 52-week high
Percent above the 52-week low
Both values are color-coded to provide immediate visual context.
Optionally draws lines connecting successive new 52-week highs, making sequences of higher highs easier to observe.
Alerts
Optional indicator alerts are included for:
New 52-week highs (Daily or Weekly mode)
Price entering defined distance zones relative to the 52-week high or low
All alerts are evaluated on confirmed bar close.
How to use
Add the indicator to any chart and select the preferred 52-week reference mode.
Use the dashboard values as context, not signals, to understand where price sits within its long-term range.
Enable alerts if you want notifications when price reaches specific distance thresholds.
Notes
In Weekly mode, values are derived from higher-timeframe weekly data and projected onto the active chart.
This script is an indicator only and does not place trades.
Educational and informational use only.
Lunch Hour Stats 1200 to 1300 NYSilver Futures Lunch Hour Statistics - how much does the price of silver fluctuate between the beginning of New York Lunch hour at 12 to 1pm. How often is it moving up vs down, by how much, etc.
Spearman Correlation🔗 Spearman Correlation – Ranked Relationship Tracker
Overview:
This indicator calculates and plots the Spearman Rank Correlation Coefficient between the current chart’s asset and a custom comparison ticker (the example shown is BTC vs the OTHERS market cap for crypto). Unlike Pearson correlation, which measures linear relationships, Spearman correlation captures monotonic (ranked) relationships—making it better suited for analysing assets that move in sync but not necessarily in a linear fashion.
🧠 What It Does:
Computes ranked correlation between two assets over a user-defined lookback period
Smooths the correlation curve for better readability
Visually shades the background by correlation strength and direction:
🟩 Strong Positive (+0.5 to +1)
🟨 Weak Positive (+0.1 to +0.5)
⬜ No Correlation (–0.1 to +0.1)
🟧 Weak Negative (–0.5 to –0.1)
🟥 Strong Negative (–1 to –0.5)
⚙️ User Inputs:
Lookback Period: Number of bars used to calculate correlation
Comparison Ticker: Choose any asset to compare against
Shading Toggles: Customize which correlation zones are highlighted
📈 Use Cases:
Identify evolving relationships between assets (e.g., BTC vs DXY, ETH vs SPX)
Spot when assets become inversely correlated or lose correlation entirely
Track regime shifts where traditional relationships break down or re-align
Use alongside trend or momentum strategies to add a cross-asset confirmation layer
🔍 Interpreting the Correlation:
+1 → Perfect positive (ranks match exactly)
+0.5 to +1 → Strong positive relationship
+0.1 to +0.5 → Weak but positive relationship
–0.1 to +0.1 → Essentially uncorrelated
–0.5 to –0.1 → Weak negative correlation
–1 to –0.5 → Strong inverse relationship
–1 → Perfect negative (rankings are completely opposite)
🧪 Technical Notes:
Calculation uses ranked returns to better reflect monotonic relationships
Smoothed with a simple moving average (SMA) for stability
Arrays are managed internally to maintain performance and adaptability
This script is ideal for traders seeking deeper insight into cross-asset dynamics, portfolio hedging, or timing divergence-based strategies.
Directional Comparisons - Two Tickers📊 Directional Comparisons – Two Tickers
Overview:
This tool allows you to visually and statistically compare the directional behaviour of any two assets on any chart timeframe. It identifies and color-codes each bar based on how both the current asset and your chosen comparison asset performed in that period (e.g., both up, both down, diverging). A statistical summary table dynamically updates in the corner of your chart, tracking the probability and streak performance of each condition.
🛠 How It Works:
Each candle is analysed and color-coded based on the relationship between the current chart's asset and a comparison asset of your choice:
✅ Green – Both tickers closed higher (bullish alignment)
🔻 Red – Both tickers closed lower (bearish alignment)
🔷 Blue – Current ticker up, comparison ticker down (positive divergence)
🟧 Orange – Current ticker down, comparison ticker up (negative divergence)
You can toggle each colour condition on/off independently.
📈 Statistical Table (Top Right):
For the candles in the visible chart range, the indicator displays:
The frequency (probability) of each condition
Longest, shortest, and average streaks for each condition
Average % change for both the current and comparison asset under each scenario
All stats auto-update as you zoom or scroll through the chart.
🔧 User Inputs:
Comparison Ticker: Choose any ticker symbol to compare against the current chart
Toggle Conditions: Enable or disable individual directional conditions (color-coded)
✅ Use Cases:
Spot high-probability alignment zones between two assets (e.g., BTC vs ETH, SPX vs VIX)
Identify divergence opportunities for trading signals
Analyse historical relationships and co-movements between assets
Perform correlation streak studies directly on the chart
🔍 Notes:
The script works across all timeframes (1min to monthly).
Stats only consider visible bars on your chart for responsiveness.
Ideal for pair traders, macro analysts, or anyone interested in cross-asset relationships.
Cumulative % Change & Inflation-Adjusted (Auto CPI by Currency)This indicator tracks an asset’s cumulative performance from a user-defined start date (T0) and compares nominal returns with inflation-adjusted (“real”) returns, automatically selecting the appropriate CPI series based on the asset currency (USD or EUR).
What it shows
Nominal cumulative return (%) from T0, based on the selected price series.
Inflation change (%) from T0, using a monthly CPI index:
USD assets: US CPI (FRED CPIAUCSL)
EUR assets: Euro Area CPI (TradingView Economics EUCPI)
Real cumulative return (%) from T0, i.e., nominal return deflated by cumulative CPI.
Key inputs
T0 (start date): Year / month / day used as the reference point.
Asset currency (USD/EUR): Drives automatic CPI selection.
Initial capital: Starting value expressed in the asset’s currency; used to display current nominal and real (inflation-adjusted) portfolio value.
Performance ticker (optional): Lets you compute performance using a different symbol than the chart (e.g., a total-return series or an accumulating ETF). If left empty, the script uses the chart’s symbol.
Outputs
Plots
Nominal cumulative % change
Real (inflation-adjusted) cumulative % change
CPI % change
Summary table
Nominal return %
Real return %
CPI change %
Reference date (T0)
Initial value
Current nominal value
Current inflation-adjusted value
Performance ticker used
Notes
CPI is monthly, so the inflation line updates in steps.
If you use a price series that does not include dividends (standard “close”), nominal/real returns may underestimate total return for dividend-paying assets.
Silver vs S&P 500 (Rebased to 100) I have ensured that silver prices and the s&p 500 price are overlayed to give the common folk an understanding. The important part is that the prices are rebased in nature. i.e. if they both started at 100 from an n year which in this case is 1992.
NY VWAP 2std to 3std Probabilities + Exit ZonesHow it works:
Time buckets
Early: 10:30 – 12:00
Mid: 12:00 – 14:00
Late: 14:00 – 16:00
Bands
2σ band (s2up / s2dn) → this is where the “potential breakout” starts.
3σ band (s3up / s3dn) → this is the “target” for the 2→3σ move.
Counting logic
If during a given bucket, the price touches the 2σ band, it counts as a 2σ hit.
If after that, in the same bucket, the price also touches the 3σ band, it counts as a 3σ hit.
Probability calculation
\text{Probability 2→3σ} = \frac{\text{# of 3σ hits}}{\text{# of 2σ hits}} \times 100
For example, if in the late session the lower 2σ band is hit 10 times, and of those 10 times, 6 eventually hit the lower 3σ band, the script will show 60%.
Labels / lines
On the chart, Upper/Lower 2→3σ probabilities are displayed per bucket.
So yes: “Late Lower 2σ → 3σ: 60%” means: if price touches the lower 2σ band in the late session, historically, 60% of those touches continued to the 3σ band.
⚠ Important caveats:
These are historical probabilities, not predictions.
Small sample sizes in a bucket can make percentages unstable early in the day.
The script only counts session NY bars (0930–1600) and ignores pre-10:30 hits to reduce opening volatility noise.
PA Bar Count (First Edition)This script is written by FanFan.
It is designed to count price action bars and identify the bar number in a sequence.
The script helps traders track bar structure and improve PA analysis.
Daily Floor PivotsDaily Floor Pivots with Comprehensive Statistical Analysis
Overview
This indicator combines traditional floor pivot levels with golden zone analysis and comprehensive statistical insights derived from 15 years of historical NQ futures data. While the pivot levels and golden zones can be applied to any instrument, the statistical tables are specifically calibrated for NQ/MNQ futures based on analysis of 2,482 NY Regular Trading Hours (RTH) sessions from 2010-2025.
What Makes This Indicator Original
Unlike standard pivot indicators that merely plot levels, this tool provides:
Enhanced Golden Zone Analysis: Calculates not only the main golden zone (0.5-0.618 retracement of previous day's range) but also golden zones between each pivot pair (PP-R1, R1-R2, R2-R3, PP-S1, S1-S2, S2-S3)
Data-Driven Statistical Tables: Two comprehensive tables displaying real statistics from 2,482 trading days of NQ analysis, including:
Probability-based touch rates and continuation patterns
Context-aware statistics based on opening position
Gap analysis and behavioral patterns
First touch dynamics and time-to-reach averages
Granular Customization: Every visual element and statistical section can be independently toggled, allowing traders to focus on what matters most to their strategy
How It Works
Pivot Calculation Methodology
The indicator uses the standard floor pivot formula based on the previous day's price action:
Pivot Point (PP) = (Previous High + Previous Low + Previous Close) / 3
Resistance Levels: R1, R2, R3 calculated from PP and previous range
Support Levels: S1, S2, S3 calculated from PP and previous range
Golden Zone Calculations
Main Golden Zone: The 0.5 to 0.618 Fibonacci retracement of the previous day's range, representing a key reversal and continuation area.
Inter-Pivot Golden Zones: For each adjacent pivot pair, golden zones are calculated as:
Resistance pairs (PP→R1, R1→R2, R2→R3): 0.5-0.618 range from the lower pivot
Support pairs (PP→S1, S1→S2, S2→S3): 0.382-0.5 range from the upper pivot
These zones represent high-probability areas where price tends to react when moving between pivot levels.
Statistical Analysis Source
All statistics displayed in the tables are derived from external Python analysis of 15 years of 1-minute NQ futures data (2010-2025), specifically analyzing NY RTH sessions (9:30 AM - 4:00 PM EST). The analysis tracked:
2,482 complete trading days
Intraday pivot touches and closes
Opening position context
Gap behavior relative to previous day
Time-of-day patterns
Sequential pivot interactions
IMPORTANT: While the pivot levels and golden zones are universally applicable mathematical calculations that work on any instrument, the statistical percentages shown in the tables are specific to NQ/MNQ behavior only. Do not assume these statistics transfer to other instruments.
Configuration Guide
Basic Settings
Number of Periods Back (1-20, default: 3)
Controls how many historical pivot periods are displayed on the chart
Setting to 1 shows only current day's pivots
Higher values show more historical context
Labels Position (Left/Right)
Choose whether pivot labels appear on the left or right side of each level line
Line Width (1-5, default: 2)
Adjust the thickness of all pivot and golden zone lines
Golden Zone Customization
Show Daily Golden Zone (0.5-0.618)
Toggle the main golden zone on/off
When enabled, displays a shaded box between the 0.5 and 0.618 retracement levels
Line Color / Fill Color
Customize the appearance of the main golden zone
Fill color determines the shaded box transparency
Show Labels / Show Prices
Control whether "0.5" and "0.618" labels appear
Control whether price values are displayed on labels
Inter-Pivot Golden Zones
Six toggle options allow you to show/hide individual golden zones:
PP to R1 / PP to S1: Most frequently touched (60.8% / 50.9%)
R1 to R2 / S1 to S2: Moderately touched (25.2% / 24.0%)
R2 to R3 / S2 to S3: Rarely touched (9.4% / 10.5%)
Line Color / Fill Color: Customize appearance of all inter-pivot zones
Show Labels / Show Prices: Control labeling for inter-pivot zones
Usage Tip: Disable outer zones (R2-R3, S2-S3) on lower volatility days to reduce chart clutter.
Pivot Display
Show Support/Resistance Levels: Master toggle for all pivot lines
Show SR Labels / Show SR Prices: Control labeling on pivot levels
Individual level toggles and colors:
PP (Pivot Point): The central reference point
R1/S1: Primary resistance/support (38.9% / 35.4% touch rate)
R2/S2: Secondary levels (15.6% / 16.1% touch rate)
R3/S3: Extended levels (5.1% / 7.3% touch rate)
Color Customization: Each level's color can be independently set
Overall Statistics Table
Show Overall Statistics Table: Master toggle
Table Size: tiny/small/normal/large/huge/auto
Table Position: Top Left/Top Right/Bottom Left/Bottom Right
Section Toggles (enable/disable individual sections):
Current Session Info
Touch & Close Rates
Continue & Reject Rates
First Touch Statistics
Golden Zone Statistics
Daily Close Distribution
Highest/Lowest Levels Reached
Context Statistics Table
Show Context Statistics Table: Master toggle
Table Size: tiny/small/normal/large/huge/auto
Table Position: Top Left/Top Right/Bottom Left/Bottom Right
Section Toggles:
Current Opening Zone
Opening Zone Statistics
Previous Day Gap Context
Understanding the Statistical Tables
TABLE 1: OVERALL STATISTICS
This table presents universal statistics from 2,482 days of NQ analysis.
Current Session Info
Displays real-time context for the active session:
Open: Where the current RTH session opened relative to pivots (e.g., "GZ_TO_R1" means opened between the PP-R1 golden zone and R1)
Now: Current price position relative to pivots
Direction: Bull (close > open), Bear (close < open), or Flat
How to use: This section helps you quickly understand where price opened and where it currently is, providing immediate context for the day's action.
Touch & Close Rates
Shows probability that each pivot level will be reached during RTH:
Touch %: Percentage of days where price touched this level at any point
Example: R1 touched 38.9% of days, PP touched 57.5% of days
Close %: Percentage of days where price closed beyond this level
Example: R1 close beyond happened 39.8% of days
How to interpret:
Higher touch rates indicate more reliable levels for intraday targeting
The difference between touch and close rates shows rejection frequency
PP has the highest touch rate (57.5%), making it the most magnetic level
Outer levels (R3/S3) have low touch rates (5.1%/7.3%), indicating rare extension days
Continue & Reject Rates
When a level is touched, these statistics show what happens next:
Continue %: Probability price continues through the level
Example: When PP is touched, price continues 88.1% of the time
Reject %: Probability price rejects from the level and reverses
Example: When R1 is touched, price rejects 50.9% of the time
How to interpret:
PP shows highest continuation (88.1%), confirming it's a poor reversal level
Support levels (S1/S2/S3) show strong rejection rates (62.5%/60.7%/56.1%), making them better reversal candidates
Continuation rates above 80% suggest the level is better as a target than an entry
First Touch Statistics
Analyzes which pivot is typically touched first during RTH:
1st Touch %: Probability this level is the first pivot encountered
PP is first touched 37.1% of days (most common)
R1 is first touched 26.0% of days
S1 is first touched 10.9% of days
1st→Continue: If this level is touched first, probability of continuation
S1-S3 show 95.6%-100% continuation when touched first
This means when price reaches support first, it usually continues lower
Avg Time: Minutes after 9:30 AM EST before first touch
PP: 1h 6m average
S3: 19m average (when bearish)
R3: 3h 19m average (when bullish)
How to interpret:
Opening away from PP means higher probability of reaching extremes (R2/R3 or S2/S3)
When support is touched first (within first 2 hours), expect continuation lower
Late-day first touches (after 2 PM) often indicate strong trending days
Multi-Touch: Shows how often levels are tested multiple times (92.8%-95.0% across all levels)
Golden Zone Statistics
Main GZ: 58.5% touch rate for the 0.5-0.618 zone
Inter-Pivot zones:
PP-R1: 60.8% (highest probability)
PP-S1: 50.9%
R1-R2: 25.2%
S1-S2: 24.0%
R2-R3: 9.4%
S2-S3: 10.5%
How to interpret:
Main GZ is touched more often than any individual resistance level
PP-R1 and PP-S1 golden zones are high-probability mean reversion areas
Outer golden zones (R2-R3, S2-S3) are only relevant on high volatility days
Daily Close Distribution
Shows where RTH sessions typically close:
Above/Below PP: 58.5% close above, 41.5% below (slight bullish bias)
Above R1: 24.5% of days
Below S1: 18.7% of days
In GZ: Only 6.3% close in the golden zone (typically transits through it)
How to interpret:
Most days (58.5%) have bullish bias (close above PP)
Less than 25% of days are strong trending days (beyond R1/S1)
Golden zone is an action area, not a resting area
Highest/Lowest Levels Reached
Distribution of the most extreme level reached:
High Resist: R1 (26.0%), R2 (10.8%), R3 (5.1%)
Low Support: S1 (35.4%), S2 (1.9%), S3 (0.6%)
How to interpret:
Most days don't reach beyond R1 or S1
R3/S3 are rare events (5.1%/0.6%), indicating major trending days
S1 is reached as lowest level more often than R1 as highest, suggesting downside is more frequently tested
TABLE 2: CONTEXT STATISTICS
This table provides conditional statistics based on how the session opened.
Current Opening Zone
Displays which of 13 possible zones the RTH session opened in:
ABOVE_R3, R2_TO_R3, R1_TO_R2, GZ_TO_R1, IN_GZ, PP_TO_GZ, AT_PP, GZ_TO_PP, S1_TO_GZ, S2_TO_S1, S3_TO_S2, BELOW_S3
How to use: This immediately tells you the market structure and what type of day to expect.
Opening Zone Statistics
Detailed statistics for the current opening zone (only shows for 6 major zones):
For each zone, you see:
Occurs: How often this opening scenario happens
GZ_TO_R1: 38.4% (most common)
AT_PP: 12.8%
S1_TO_GZ: 24.2%
R1_TO_R2: 9.4%
S2_TO_S1: 6.3%
IN_GZ: 3.8%
Bull/Bear %: Close direction probability
Example: GZ_TO_R1 is perfectly balanced (50.0% bull / 49.6% bear)
R1_TO_R2 is bullish (58.1% bull / 41.0% bear)
Levels Hit: Probability of reaching each pivot level from this opening
Helps identify high-probability targets
Example: From GZ_TO_R1, PP is hit 52.9%, R1 is hit 49.0%, S1 is hit 21.6%
How to interpret:
GZ_TO_R1 (most common): Balanced day, watch PP and GZ for direction clues
AT_PP: Slight bullish bias (56.9%), high chance of touching both PP (92.8%) and GZ (90.3%)
R1_TO_R2: Bullish bias (58.1%), expect continuation to R2 (58.1% chance)
S2_TO_S1: Bullish reversal setup (59.9%), very high chance of S1 touch (82.8%)
IN_GZ: Rare opening (3.8%), bullish bias, virtually guaranteed GZ touch (100%)
Previous Day Gap Context
Shows current gap scenario and typical behavior:
Three scenarios:
GAP UP: Opened Above Yesterday's High (20.5% of days)
R1 Touch: 65.9% (high probability)
R2 Touch: 42.1%
S1 Touch: 15.0% (low probability)
Bias: Bullish continuation
GAP DOWN: Opened Below Yesterday's Low (11.3% of days)
S1 Touch: 71.5% (high probability)
S2 Touch: 55.2%
R1 Touch: 12.1% (low probability)
Bias: Bearish continuation
NO GAP: Opened Within Yesterday's Range (68.2% of days)
PP Touch: 69.5%
GZ Touch: 71.7%
R1 Touch: 35.2%
Bias: Balanced (watch for direction at PP/GZ)
How to interpret:
Gap days (up or down) tend to continue in the gap direction
When gapping, fade trades are low probability (15.0% and 12.1%)
Most days (68.2%) open within previous range, making PP and GZ critical decision zones
The "bias" line provides clear directional guidance for trade selection
Practical Application Examples
Example 1: Standard Day Setup
Scenario: RTH opens at 20,450
PP: 20,400
GZ: 20,390-20,395
R1: 20,425
Previous day high: 20,460
What the tables tell you:
Opening Zone: "GZ_TO_R1" (38.4% occurrence)
Gap Context: "NO GAP" (68.2% occurrence)
Expected behavior: Balanced (50/50 bull/bear)
High probability: PP touch (52.9%), GZ touch (56.8%)
Moderate probability: R1 touch (49.0%), S1 touch (21.6%)
Trade plan:
Wait for price to reach PP (52.9% chance) or GZ (56.8% chance)
Look for directional confirmation at these levels
First target R1 if bullish, S1 if bearish
Avoid assuming direction without confirmation (perfectly balanced opening)
Example 2: Gap Up Day
Scenario: RTH opens at 20,510
Previous day high: 20,460
R1: 20,425
R2: 20,475
What the tables tell you:
Gap Context: "GAP UP" (20.5% occurrence)
R1 touch: 65.9% probability
R2 touch: 42.1% probability
S1 touch: Only 15.0% probability
Bias: Bullish continuation
Trade plan:
Favor long setups
Target R1 first (65.9% chance), then R2 (42.1%)
If R1 breaks, R2 becomes likely target
Shorting is low probability (only 15.0% reach S1)
Example 3: Opening in Golden Zone
Scenario: RTH opens at 20,393
PP: 20,400
GZ: 20,390-20,395
What the tables tell you:
Opening Zone: "IN_GZ" (rare, only 3.8% occurrence)
Bullish bias: 58.1%
GZ touch: 100% (guaranteed - already there)
PP touch: 75.3%
R1 touch: 41.9%
Trade plan:
Expect price to test PP (75.3% chance)
Slight bullish bias suggests long setups better than shorts
Watch how price reacts at PP - likely to continue to R1 (41.9%)
This is an uncommon opening, suggesting potential for larger moves
Best Practices
Match Your Instrument: Remember, statistics are NQ-specific. If trading other instruments, use the levels but disregard the statistical percentages.
Combine with Price Action: Use the statistics for probability context, not as standalone signals. Always confirm with price action, volume, and your trading methodology.
Adapt Table Display: Don't display all sections all the time. Toggle based on your trading phase:
Pre-market: Focus on "Gap Context" to understand the setup
Market open: Watch "Opening Zone Statistics" for directional bias
Intraday: Monitor "Current Session Info" for position tracking
Understand Context: A 60% touch rate doesn't mean guaranteed—it means 40% of days don't touch. Use these probabilities to size positions and manage expectations.
Inter-Pivot Golden Zones: These are most useful when price is already in motion toward a level. For example, if price breaks above PP heading to R1, the PP-R1 golden zone (60.8% touch rate) becomes a high-probability pullback area.
Time Awareness: The "Avg Time" statistics help you understand urgency. If it's 10:30 AM and S1 hasn't been touched (average is 55 minutes), the window for bearish moves is closing.
Technical Notes
Time Zone: All times referenced are NY/EST
Session Definition: RTH is 9:30 AM - 4:00 PM EST
Calculation Period: Pivots update daily based on previous 24-hour period (18:00 previous day to 17:00 current day)
Data Source: Statistics derived from 12 years of NQ 1-minute futures data (2013-2025)
Sample Size: 2,482 complete RTH trading sessions
Disclaimer
This indicator provides statistical probabilities based on historical NQ futures data. Past performance does not guarantee future results. The statistical tables are educational tools and should not be the sole basis for trading decisions. Always:
Use proper risk management
Combine with your own analysis
Understand that probabilities are not certainties
Remember that statistics are instrument-specific (NQ/MNQ only)
Credits
Statistical analysis performed using Python analysis of 12 years of historical NQ futures data. All pivot and golden zone calculations use standard mathematical formulas applicable to any instrument.
DERYA Dynamic Efficiency Regime Yield AnalyzerDERYA: Dynamic Efficiency Regime Yield Analyzer
Mathematical Concept and Problem Statement
Most traditional trend and momentum indicators (e.g., RSI, ADX, MACD) focus on price displacement across a series of bars. However, they are mathematically "blind" to the internal structure of each individual bar. The DERYA indicator solves the "Velocity Trap" and "Lagging Confirmation" issues by shifting the measurement space from price displacement to intrabar efficiency. It quantifies the ratio between net price progress and the total effort (range) expended within the bar.
Logic and Components
The script does not reuse any existing open-source library logic; the methodology is derived from original research. However, it utilizes standard built-in Pine Script functions for structural stabilization:
Efficiency Metaphor: The core logic calculates a proxy for microstructural health using the formula |Close - Close | / (High - Low).
Use of Exponential Moving Average (EMA): A standard ta.ema is applied to the raw efficiency data. Reason for use: Raw microstructural data is inherently noisy due to high-frequency fluctuations. The EMA is used here specifically as a low-pass filter to extract the underlying structural trend of efficiency without the overhead of more complex digital filters.
Use of Min-Max Normalization: The script utilizes ta.highest and ta.lowest over a lookback period. Reason for use: To convert an absolute efficiency metric into a bounded state variable (0-100). This ensures the indicator is adaptive to different volatility regimes, preventing the signal from becoming obsolete as market conditions change.
Interpretation
Expansion Regime (>60): Indicates a high-efficiency environment where price movement is achieved with minimal internal friction.
Collapse Regime (<40): Indicates a structural deterioration where price effort (range) significantly outweighs price progress (displacement), often signaling an imminent trend break.
Visual Integration: The script includes a barcolor feature that highlights bars where DERYA falls below 30, visually flagging points of extreme structural inefficiency directly on the price chart.
Compliance Note
This script is an original implementation of the DERYA methodology. It does not contain "copy-pasted" code from other public indicators. Standard functions (ta.ema, ta.highest, ta.lowest) are used only for their intended mathematical smoothing and normalization purposes as described above.
Scientific Documentation & Research Paper
This implementation is based on the following published research:
Title: DERYA: Dynamic Efficiency Regime Yield Analyzer - A New Microstructural State Variable for Financial Markets
Published on: Zenodo (CERN)
zenodo.org
DOI: 10.5281/zenodo.18181902
Author: Bülent Duman (Independent Researcher)
Copyright: (C) 2026 Bülent Duman
Compression-to-Expansion Early Warning (CEEWS)The Compression → Expansion Early Warning System (CEEWS) is a volatility-structure and market-timing indicator designed to identify periods of statistical price compression and to signal when that compression transitions into directional expansion. Rather than predicting direction in advance, CEEWS focuses on detecting when price action becomes tightly constrained and then confirms when stored energy begins to release.
CEEWS quantifies compression using a composite of volatility contraction, range tightening, candle overlap, and reference-level convergence, producing a normalized Build score (0–100) that reflects the degree of latent price pressure. Elevated Build values indicate that the market is coiled and increasingly susceptible to movement, while expansion signals occur only when volatility begins to expand and price breaks from its recent range.
The indicator is intended as a timing and transition tool, not a standalone trend or directional system. CEEWS is most effective when paired with broader regime or trend-health indicators and is particularly well suited for index funds and highly liquid markets, where prolonged consolidation phases often precede sharp directional moves. Its primary purpose is to help traders identify when the market is likely to move, not to forecast where it will go.
Adjustable Price Line Size with Countdown Timer (Larger)Adjustable Size and Color for the Price Line and Timer so I Can See it Better From Across the Room...
Adjustments include: Price Line Width Size and Color (Small, Normal, Large, Huge)
Adjustment for: Solid Line, Dashed or Dotted Line
Countdown Timer: ON/OFF
I Can Now See The Price and Price Line From Across the Room!!
[GYTS] VolatilityToolkit LibraryVolatilityToolkit Library
🌸 Part of GoemonYae Trading System (GYTS) 🌸
🌸 --------- INTRODUCTION --------- 🌸
💮 What Does This Library Contain?
VolatilityToolkit provides a comprehensive suite of volatility estimation functions derived from academic research in financial econometrics. Rather than relying on simplistic measures, this library implements range-based estimators that extract maximum information from OHLC data — delivering estimates that are 5–14× more efficient than traditional close-to-close methods.
The library spans the full volatility workflow: estimation, smoothing, and regime detection.
💮 Key Categories
• Range-Based Estimators — Parkinson, Garman-Klass, Rogers-Satchell, Yang-Zhang (academically-grounded variance estimators)
• Classical Measures — Close-to-Close, ATR, Chaikin Volatility (baseline and price-unit measures)
• Smoothing & Post-Processing — Asymmetric EWMA for differential decay rates
• Aggregation & Regime Detection — Multi-horizon blending, MTF aggregation, Volatility Burst Ratio
💮 Originality
To the best of our knowledge, no other TradingView script combines range-based estimators (Parkinson, Garman-Klass, Rogers-Satchell, Yang-Zhang), classical measures, and regime detection tools in a single package. Unlike typical volatility implementations that offer only a single method, this library:
• Implements four academically-grounded range-based estimators with proper mathematical foundations
• Handles drift bias and overnight gaps, issues that plague simpler estimators in trending markets
• Integrates with GYTS FiltersToolkit for advanced smoothing (10 filter types vs. typical SMA-only)
• Provides regime detection tools (Burst Ratio, MTF aggregation) for systematic strategy integration
• Standardises output units for seamless estimator comparison and swapping
🌸 --------- ADDED VALUE --------- 🌸
💮 Academic Rigour
Each estimator implements peer-reviewed methodologies with proper mathematical foundations. The library handles aspects that are easily missed, e.g. drift independence, overnight gap adjustment, and optimal weighting factors. All functions include guards against edge cases (division by zero, negative variance floors, warmup handling).
💮 Statistical Efficiency
Range-based estimators extract more information from the same data. Yang-Zhang achieves up to 14× the efficiency of close-to-close variance, meaning you can achieve the same estimation accuracy with far fewer bars — critical for adapting quickly to changing market conditions.
💮 Flexible Smoothing
All estimators support configurable smoothing via the GYTS FiltersToolkit integration. Choose from 10 filter types to balance responsiveness against noise reduction:
• Ultimate Smoother (2-Pole / 3-Pole) — Near-zero lag; the 3-pole variant is a GYTS design with tunable overshoot
• Super Smoother (2-Pole / 3-Pole) — Excellent noise reduction with minimal lag
• BiQuad — Second-order IIR filter with quality factor control
• ADXvma — Adaptive smoothing based on directional volatility
• MAMA — Cycle-adaptive moving average
• A2RMA — Adaptive autonomous recursive moving average
• SMA / EMA — Classical averages (SMA is default for most estimators)
Using Infinite Impulse Response (IIR) filters (e.g. Super Smoother, Ultimate Smoother) instead of SMA avoids the "drop-off artefact" where volatility readings crash when old spikes exit the window.
💮 Plug-and-Play Integration
Standardised output units (per-bar log-return volatility) make it trivial to swap estimators. The annualize() helper converts to yearly volatility with a single call. All functions work seamlessly with other GYTS components.
🌸 --------- RANGE-BASED ESTIMATORS --------- 🌸
These estimators utilise High, Low, Open, and Close prices to extract significantly more information about the underlying diffusion process than close-only methods.
💮 parkinson()
The Extreme Value Method -- approximately 5× more efficient than close-to-close, requiring about 80% less data for equivalent accuracy. Uses only the High-Low range, making it simple and robust.
• Assumption: Zero drift (random walk). May be biased in strongly trending markets.
• Best for: Quick volatility reads when drift is minimal.
• Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Parkinson, M. (1980). The Extreme Value Method for Estimating the Variance of the Rate of Return. Journal of Business, 53 (1), 61–65. DOI
💮 garman_klass()
Extends Parkinson by incorporating Open and Close prices, achieving approximately 7.4× efficiency over close-to-close. Implements the "practical" analytic estimator (σ̂²₅) which avoids cross-product terms whilst maintaining near-optimal efficiency.
• Assumption: Zero drift, continuous trading (no gaps).
• Best for: Markets with minimal overnight gaps and ranging conditions.
• Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Garman, M.B. & Klass, M.J. (1980). On the Estimation of Security Price Volatilities from Historical Data. Journal of Business, 53 (1), 67–78. DOI
💮 rogers_satchell()
The drift-independent estimator correctly isolates variance even in strongly trending markets where Parkinson and Garman-Klass become significantly biased. Uses the formula: ln(H/C)·ln(H/O) + ln(L/C)·ln(L/O).
• Key advantage: Unbiased regardless of trend direction or magnitude.
• Best for: Trending markets, crypto (24/7 trading with minimal gaps), general-purpose use.
• Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Rogers, L.C.G. & Satchell, S.E. (1991). Estimating Variance from High, Low and Closing Prices. Annals of Applied Probability, 1 (4), 504–512. DOI
💮 yang_zhang()
The minimum-variance composite estimator — both drift-independent AND gap-aware. Combines overnight returns, open-to-close returns, and the Rogers-Satchell component with optimal weighting to minimise estimator variance. Up to 14× more efficient than close-to-close.
• Parameters: lookback (default 14, minimum 2), alpha (default 1.34, optimised for equities).
• Best for: Equity markets with significant overnight gaps, highest-quality volatility estimation.
• Note: Unlike other estimators, Yang-Zhang does not support custom filter types — it uses rolling sample variance internally.
Source: Yang, D. & Zhang, Q. (2000). Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices. Journal of Business, 73 (3), 477–491. DOI
🌸 --------- CLASSICAL MEASURES --------- 🌸
💮 close_to_close()
Classical sample variance of logarithmic returns. Provided primarily as a baseline benchmark — it is approximately 5–8× less efficient than range-based estimators, requiring proportionally more data for the same accuracy.
• Parameters: lookback (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
• Use case: Comparison baseline, situations requiring strict methodological consistency with academic literature.
💮 atr()
Average True Range -- measures volatility in price units rather than log-returns. Directly interpretable for stop-loss placement (e.g., "2× ATR trailing stop") and handles gaps naturally via the True Range formula.
• Output: Price units (not comparable across different price levels).
• Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
• Best for: Position sizing, trailing stops, any application requiring volatility in currency terms.
Source: Wilder, J.W. (1978). New Concepts in Technical Trading Systems . Trend Research.
💮 chaikin_volatility()
Rate of Change of the smoothed trading range. Unlike level-based measures, Chaikin Volatility shows whether volatility is expanding or contracting relative to recent history.
• Output: Percentage change (oscillates around zero).
• Parameters: length (default 10), roc_length (default 10), filter_type (default EMA), smoothing_factor (default 0.7)
• Interpretation: High values suggest nervous, wide-ranging markets; low values indicate compression.
• Best for: Detecting volatility regime shifts, breakout anticipation.
🌸 --------- SMOOTHING & POST-PROCESSING --------- 🌸
💮 asymmetric_ewma()
Differential smoothing with separate alphas for rising versus falling volatility. Allows volatility to spike quickly (fast reaction to shocks) whilst decaying slowly (stability). Essential for trailing stops that should widen rapidly during turbulence but narrow gradually.
• Parameters: alpha_up (default 0.1), alpha_down (default 0.02).
• Note: Stateful function — call exactly once per bar.
💮 annualize()
Converts per-bar volatility to annualised volatility using the square-root-of-time rule: σ_annual = σ_bar × √(periods_per_year).
• Parameters: vol (series float), periods (default 252 for daily equity bars).
• Common values: 365 (crypto), 52 (weekly), 12 (monthly).
🌸 --------- AGGREGATION & REGIME DETECTION --------- 🌸
💮 weighted_horizon_volatility()
Blends volatility readings across short, medium, and long lookback horizons. Inspired by the Heterogeneous Autoregressive (HAR-RV) model's recognition that market participants operate on different time scales.
• Default horizons: 1-bar (short), 5-bar (medium), 22-bar (long).
• Default weights: 0.5, 0.3, 0.2.
• Note: This is a weighted trailing average, not a forecasting regression. For true HAR-RV forecasting, it would be required to fit regression coefficients.
Inspired by: Corsi, F. (2009). A Simple Approximate Long-Memory Model of Realized Volatility. Journal of Financial Econometrics .
💮 volatility_mtf()
Multi-timeframe aggregation for intraday charts. Combines base volatility with higher-timeframe (Daily, Weekly, Monthly) readings, automatically scaling HTF volatilities down to the current timeframe's magnitude using the square-root-of-time rule.
• Usage: Calculate HTF volatilities via request.security() externally, then pass to this function.
• Behaviour: Returns base volatility unchanged on Daily+ timeframes (MTF aggregation not applicable).
💮 volatility_burst_ratio()
Regime shift detector comparing short-term to long-term volatility.
• Parameters: short_period (default 8), long_period (default 50), filter_type (default Super Smoother 2-Pole), smoothing_factor (default 0.7)
• Interpretation: Ratio > 1.0 indicates expanding volatility; values > 1.5 often precede or accompany explosive breakouts.
• Best for: Filtering entries (e.g., "only enter if volatility is expanding"), dynamic risk adjustment, breakout confirmation.
🌸 --------- PRACTICAL USAGE NOTES --------- 🌸
💮 Choosing an Estimator
• Trending equities with gaps: yang_zhang() — handles both drift and overnight gaps optimally.
• Crypto (24/7 trading): rogers_satchell() — drift-independent without the lag of Yang-Zhang's multi-period window.
• Ranging markets: garman_klass() or parkinson() — simpler, no drift adjustment needed.
• Price-based stops: atr() — output in price units, directly usable for stop distances.
• Regime detection: Combine any estimator with volatility_burst_ratio().
💮 Output Units
All range-based estimators output per-bar volatility in log-return units (standard deviation). To convert to annualised percentage volatility (the convention in options and risk management), use:
vol_annual = annualize(yang_zhang(14), 252) // For daily bars
vol_percent = vol_annual * 100 // Express as percentage
💮 Smoothing Selection
The library integrates with FiltersToolkit for flexible smoothing. General guidance:
• SMA: Classical, statistically valid, but suffers from "drop-off" artefacts when spikes exit the window.
• Super Smoother / Ultimate Smoother / BiQuad: Natural decay, reduced lag — preferred for trading applications.
• MAMA / ADXvma / A2RMA: Adaptive smoothing, sometimes interesting for highly dynamic environments.
💮 Edge Cases and Limitations
• Flat candles: Guards prevent log(0) errors, but single-tick bars produce near-zero variance readings.
• Illiquid assets: Discretisation bias causes underestimation when ticks-per-bar is small. Use higher timeframes for more reliable estimates.
• Yang-Zhang minimum: Requires lookback ≥ 2 (enforced internally). Cannot produce instantaneous readings.
• Drift in Parkinson/GK: These estimators overestimate variance in trending conditions — switch to Rogers-Satchell or Yang-Zhang.
Note: This library is actively maintained. Suggestions for additional estimators or improvements are welcome.






















