Indicator

Volatility Regime OscillatorVolatility Regime Oscillator
OVERVIEW
A 0-100 oscillator confined to the one thing volatility truly does: measure and manage risk. It forecasts how large moves are likely to be, places that forecast on a self-normalising 0-100 percentile scale (calm → extreme), and reports the position-size multiplier a volatility-targeting approach would call for. You read it next to your own method and size accordingly. It places no orders, gives no entry/exit signals, and takes no view on direction. Volatility's only job here is how big, never which way — that restraint is the whole design.
WHY THESE METHODS BELONG IN ONE SCRIPT (mashup rationale)
This is not a folder of separate volatility studies — it is one pipeline, and each stage feeds the next:
Estimate. Range-based estimators (Yang-Zhang, Garman-Klass, Rogers-Satchell, Parkinson) measure realised volatility far more efficiently than close-to-close; combining them is more robust out-of-sample than trusting any single one.
Forecast. A HAR multi-horizon blend (with an optional measurement-error correction that shifts weight off the noisy fast term), EWMA, or window mean turns that estimate forward.
Character. Good/bad semivariance and vol-of-vol report whether the move is downside-driven and whether the volatility itself is stable — context a single number can't carry.
Regime. A percentile rank converts the forecast into a self-normalising 0-100 read, so the same calm/normal/high/extreme bands work on any symbol or timeframe.
Size. Volatility targeting turns the forecast into an exposure multiplier — blended toward constant exposure and gated down in extremes, the robust drawdown-reducing form.
A forecaster without a regime frame is just a number; a regime read without sizing is just a gauge; sizing without the de-risk gates is the naive targeting the research shows underwhelms. Chained, they answer one question end to end: how big is risk now, and what does that imply for size? Remove a stage and the chain breaks.
HOW IT IS DIFFERENT FROM A PLAIN VOLATILITY FORECASTER
Most volatility tools answer "what will volatility be?" This one answers "where does volatility sit, and how much should I size?" The forecast is only the input; the output is a regime percentile plus a position-sizing multiplier — vol targeting, conditional targeting, a managed/constant blend, downside scaling, and an optional stress gate — wrapped in a risk-management frame. It is a sizing and regime gauge, not a forecasting study.
HOW TO USE
Oscillator 0-100 = where current forecast vol sits in its own history (percentile). Bands: <25 calm, 25-65 normal, 65-90 high, ≥90 extreme.
Dotted marker = where your target vol sits in that distribution. Line above the marker = vol above target → size down; below = room to size up.
Suggested exposure (dashboard) = the vol-target multiplier of equity a long would use now (1.0× = 100%). Apply it to your own side.
Optional expected-move envelope on the price chart shows the size of the likely move (for stop placement) — symmetric, regime-coloured, never a direction or target.
UNIVERSAL ACROSS MARKETS
The estimators read OHLC, so it runs on any instrument and timeframe out of the box. An optional Analyse symbol input reroutes the calculation to a different instrument than the one charted. Annualisation is derived from the chart timeframe by default (so the forecast-vol % and the target marker read sensibly on any timeframe), with a manual bars-per-year override available. The India VIX stress gate is OFF by default because it reads an India-specific implied-vol symbol that would mislead on other markets — turn it on only for NIFTY / BANKNIFTY.
ACCURACY — AN HONEST NOTE
This contains the most advanced volatility methods genuinely computable from price bars. It does not and cannot contain the options-data frontier — rough-volatility calibration (rough Heston / fractional Brownian), deep-learning forecasters, or implied-vol-surface models — none of which run on chart OHLC. Even at its best, realised-vol forecasting explains only a minority of realised-vol variance. Treat this as a sharper estimate and a disciplined risk gauge, not a precise or certain forecast. The "suggested exposure" is context for your own risk process, not an instruction; the research is explicit that full vol-targeting often fails to beat constant exposure out of sample — the keepable part is tail/drawdown reduction, which is why sizing is blended toward constant exposure by default.
ORIGINALITY
The individual methods are public and credited below. The original work is the assembly: a single self-normalising oscillator that chains efficient range estimators → a measurement-error-corrected HAR forecast → a semivariance/vol-of-vol character read → a percentile regime → a blended, gated volatility-targeting exposure, with a regime-coloured expected-move envelope — a risk-and-sizing gauge rather than a forecast or a directional signal. No third-party Pine code is reused.
CONCEPT CREDIT
Volatility estimators — M. Parkinson (1980); Garman & Klass (1980); Rogers & Satchell (1991); Yang & Zhang (2000). HAR forecaster — Fulvio Corsi (2009); measurement-error (HARQ) correction — Bollerslev, Patton & Quaedvlieg (2016). EWMA / RiskMetrics — J.P. Morgan (1996). Good/bad realised semivariance — Barndorff-Nielsen, Kinnebrock & Shephard; Patton & Sheppard (2015). Path-dependent leverage effect — Julien Guyon & Jordan Lekeufack (2023). Volatility targeting / conditional targeting — Moreira & Muir (2017); Harvey et al. (2018); robustness caveats — Cederburg et al. (2020); Wang & Yan (2021). Assembly, oscillator framing, regime bands and the target marker are the author's own work. Not affiliated with, nor endorsed by, any third party.
DISCLAIMER
Educational risk-management gauge. NOT financial advice, NOT a signal, and NO guarantee of any outcome. Estimates from price can be wrong, especially through structural breaks and on low-history symbols. Trading carries risk of loss. Do your own research and manage your own risk. The author accepts no liability for any use of this script. Indicator

Variance Risk Premium OscillatorVariance Risk Premium Oscillator
What it does
The Variance Risk Premium Oscillator measures the gap between implied volatility (a volatility index such as India VIX) and realized volatility, scaled in standard-deviation (σ) units. That gap — the variance risk premium (VRP) — tells you whether option protection is currently rich (expensive, complacent) or cheap (underpriced, stressed). A vol-of-vol read is shown alongside as an instability gauge.
Why this is different (and original)
Most volatility tools on charts forecast or display realized volatility (ATR, standard-deviation bands, historical-vol plots). This one reads something different: the price of volatility insurance. Decades of research show implied volatility systematically exceeds the volatility that is subsequently realized, so the premium is, on average, positive — investors pay up for protection. When that premium stretches unusually high, protection is expensive and the crowd is complacent; when it collapses or turns negative, fear is being paid for and volatility is cheap. Presenting this premium as a clean, self-normalizing mean-reversion oscillator with a built-in edge test is what makes it original — it is not a realized-vol band and not a VIX plot.
How it works
Realized volatility = annualized standard deviation of log-returns over the chosen window.
Implied volatility = the volatility index you point it at.
VRP = Implied − Realized.
The VRP series is z-scored over the normalization window into the σ oscillator. Vol-of-vol (the standard deviation of the implied index) is tracked separately as an instability read in the dashboard.
How to use it
Above the upper (red) band = vol RICH / complacency — protection expensive.
Below the lower (green) band = vol CHEAP / stress — protection underpriced.
Turns out of an extreme (triangles) are the mean-reversion events: a turn up from the cheap zone often coincides with stress easing; a turn down from the rich zone with complacency ending.
Read the EDGE row. The harness checks whether, after a cheap-zone turn, price actually rallied (and after a rich-zone turn, faded) by ≥ k×ATR within the horizon, versus the unconditional Base %. EDGE = Hit − Base. If it is near zero on your market, the mean-reversion read is not paying there.
Settings guide
01 · Data & Volatility — implied-vol symbol, realized-vol length, annualization (252 for daily; bars-per-year for intraday), vol-of-vol length, universal price source.
02 · Normalization — z-score window, output smoothing.
03 · Calibration — horizon, favourable-move threshold (×ATR), base-rate window.
04 · Bands — stretch and extreme σ bands; divergence pivot.
05 · Display & Theme — visual style, regime tint, dashboard, colors.
Non-repaint
The implied-vol index is requested with lookahead_off and settles on its bar's close — no future leak.
Concept credit
Variance risk premium and its return predictability — Bakshi & Kapadia (2003); Carr & Wu (2009); Bollerslev, Tauchen & Zhou (2009); Coval & Shumway (2001).
Disclaimer
For research and education only. Not financial advice, not a recommendation, and not a guarantee of future results. A stretched premium does not guarantee reversion — regimes can stay rich or cheap for long stretches. All statistics are in-sample, close-to-close, and exclude costs. Do your own research and manage your own risk. Indicator

Indicator

Inter-Exchanges Crypto Price Spread Clouds (Tartigradia)Display variations in min-max and median values of high, low and close across exchanges. It's a kind of realized volatility indicator, as the idea is that in times of high volatility (high emotions, fear, uncertainty), it's more likely that market inefficiencies will appear for the same asset between different market makers, ie, the price can temporarily differ a lot. This indicator will catch these instants of high differences between exchanges, even if they lasted only an instant (because we use high and low values).
Compared with my other "Inter-Exchanges Crypto Price Spread Deviation" indicator, this one overlays directly on the chart, and offers a different take based on the same premisses. Instead of summarizing volatility via standard deviation, here we display clouds of the range of values that were observed.
A big advantage of this approach is that it can also be used to determine safe stop loss levels, especially the values of percentile rank (i.e., what are the high values that were observed in at least 50% of exchanges?).
Indeed, all price levels are displayed in the indicator's status bar:
green for high values,
red for low values,
aqua for median,
purple for average,
The first two values are max and min values of high across exchanges (in green).
The next two values are max and min of low across exchanges (in red).
The next two values are median (aqua) and average (purple).
The last two values are percentile rank values for high (green) and low (red) respectively.
Another advantage is that the high (green) vs low (red) clouds can be seen as representing the buying or selling pressure respectively across exchanges, and this may in itself provide a signal to know whether one side is winning.
Link to my other complementary indicator:
Compared to other inter-exchanges spread indicators, this one offers two major features:
The symbol automatically adapts to the symbol currently selected in user's chart. Hence, switching between tickers does not require the user to modify any option, everything is dynamically updated behind the scenes.
It's easy to add more exchanges (requires some code editing because PineScript v5 does not allow dynamical request.security() calls).
Limitations/things to know:
History is limited to what the ticker itself display. Ie, even if the exchanges specified in this indicator have more data than the ticker currently displayed in the user's chart, the indicator will show only a timeperiod as long as the chart.
The indicator can manage multiple exchanges of different historical length (ie, some exchanges having more data going way earlier in the past than others), in which case they will simply be ignored from calculations when far back in the past. Hence, you should be aware that the further you go in the past, the less exchanges will have such data, and hence the less accurate the measures will be (because the deviation will be calculated from less sources than more recent bars). This is thanks to how the array.* math functions behave in case of na values, they simply skip them from calculations, contrary to math.* functions.
Indicator

Inter-Exchanges Crypto Price Spread Deviation (Tartigradia)Measures the deviation of price metrics between various exchanges. It's a kind of realized volatility indicator, as the idea is that in times of high volatility (high emotions, fear, uncertainty), it's more likely that market inefficiencies will appear for the same asset between different market makers, ie, the price can temporarily differ a lot. This indicator will catch these instants of high differences between exchanges, even if they lasted only an instant (because we use high and low values).
Both standard deviation and median absolute deviation (more robust to outliers, ie, exchanges with a very different price from others won't influence the median absolute deviation, but the standard deviation yes).
Compared to other inter-exchanges spread indicators, this one offers two major features:
* The symbol automatically adapts to the symbol currently selected in user's chart. Hence, switching between tickers does not require the user to modify any option, everything is dynamically updated behind the scenes.
* It's easy to add more exchanges (requires some code editing because PineScript v5 does not allow dynamical request.security() calls).
Limitations/things to know:
* History is limited to what the ticker itself display. Ie, even if the exchanges specified in this indicator have more data than the ticker currently displayed in the user's chart, the indicator will show only a timeperiod as long as the chart.
* The indicator can manage multiple exchanges of different historical length (ie, some exchanges having more data going way earlier in the past than others), in which case they will simply be ignored from calculations when far back in the past. Hence, you should be aware that the further you go in the past, the less exchanges will have such data, and hence the less accurate the measures will be (because the deviation will be calculated from less sources than more recent bars). This is thanks to how the array.* math functions behave in case of na values, they simply skip them from calculations, contrary to math.* functions. Indicator

Implied Volatility Estimator using Black Scholes [Loxx]Implied Volatility Estimator using Black Scholes derives a estimation of implied volatility using the Black Scholes options pricing model. The Bisection algorithm is used for our purposes here. This includes the ability to adjust for dividends.
Implied Volatility
The implied volatility (IV) of an option contract is that value of the volatility of the underlying instrument which, when input in an option pricing model (such as Black–Scholes), will return a theoretical value equal to the current market price of that option. The VIX , in contrast, is a model-free estimate of Implied Volatility. The latter is viewed as being important because it represents a measure of risk for the underlying asset. Elevated Implied Volatility suggests that risks to underlying are also elevated. Ordinarily, to estimate implied volatility we rely upon Black-Scholes (1973). This implies that we are prepared to accept the assumptions of Black Scholes (1973).
Inputs
Spot price: select from 33 different types of price inputs
Strike Price: the strike price of the option you're wishing to model
Market Price: this is the market price of the option; choose, last, bid, or ask to see different results
Historical Volatility Period: the input period for historical volatility ; historical volatility isn't used in the Bisection algo, this is to serve as a comparison, even though historical volatility is from price movement of the underlying asset where as implied volatility is the volatility of the option
Historical Volatility Type: choose from various types of implied volatility , search my indicators for details on each of these
Option Base Currency: this is to calculate the risk-free rate, this is used if you wish to automatically calculate the risk-free rate instead of using the manual input. this uses the 10 year bold yield of the corresponding country
% Manual Risk-free Rate: here you can manually enter the risk-free rate
Use manual input for Risk-free Rate? : choose manual or automatic for risk-free rate
% Manual Yearly Dividend Yield: here you can manually enter the yearly dividend yield
Adjust for Dividends?: choose if you even want to use use dividends
Automatically Calculate Yearly Dividend Yield? choose if you want to use automatic vs manual dividend yield calculation
Time Now Type: choose how you want to calculate time right now, see the tool tip
Days in Year: choose how many days in the year, 365 for all days, 252 for trading days, etc
Hours Per Day: how many hours per day? 24, 8 working hours, or 6.5 trading hours
Expiry date settings: here you can specify the exact time the option expires
*** the algorithm inputs for low and high aren't to be changed unless you're working through the mathematics of how Bisection works.
Included
Option pricing panel
Loxx's Expanded Source Types
Related Indicators
Cox-Ross-Rubinstein Binomial Tree Options Pricing Model
Indicator

rv_iv_vrpThis script provides realized volatility (rv), implied volatility (iv), and volatility risk premium (vrp) information for each of CBOE's volatility indices. The individual outputs are:
- Blue/red line: the realized volatility. This is an annualized, 20-period moving average estimate of realized volatility--in other words, the variability in the instrument's actual returns. The line is blue when realized volatility is below implied volatility, red otherwise.
- Fuchsia line (opaque): the median of realized volatility. The median is based on all data between the "start" and "end" dates.
- Gray line (transparent): the implied volatility (iv). According to CBOE's volatility methodology, this is similar to a weighted average of out-of-the-money ivs for options with approximately 30 calendar days to expiration. Notice that we compare rv20 to iv30 because there are about twenty trading periods in thirty calendar days.
- Fuchsia line (transparent): the median of implied volatility.
- Lightly shaded gray background: the background between "start" and "end" is shaded a very light gray.
- Table: the table shows the current, percentile, and median values for iv, rv, and vrp. Percentile means the value is greater than "N" percent of all values for that measure.
-----
Volatility risk premium (vrp) is simply the difference between implied and realized volatility. Along with implied and realized volatility, traders interpret this measure in various ways. Some prefer to be buying options when there volatility, implied or realized, reaches absolute levels, or low risk premium, whereas others have the opposite opinion. However, all volatility traders like to look at these measures in relation to their past values, which this script assists with.
By the way, this script is similar to my "vol premia," which provides the vrp data for all of these instruments on one page. However, this script loads faster and lets you see historical data. I recommend viewing the indicator and the corresponding instrument at the same time, to see how volatility reacts to changes in the underlying price. Indicator

vol_premiaThis script shows the volatility risk premium for several instruments. The premium is simply "IV30 - RV20". Although Tradingview doesn't provide options prices, CBOE publishes 30-day implied volatilities for many instruments (most of which are VIX variations). CBOE calculates these in a standard way, weighting at- and out-of-the-money IVs for options that expire in 30 days, on average. For realized volatility, I used the standard deviation of log returns. Since there are twenty trading periods in 30 calendar days, IV30 can be compared to RV20. The "premium" is the difference, which reflects market participants' expectation for how much upcoming volatility will over- or under-shoot recent volatility.
The script loads pretty slow since there are lots of symbols, so feel free to delete the ones you don't care about. Hopefully the code is straightforward enough. I won't list the meaning of every symbols here, since I might change them later, but you can type them into pulsewire for data, and read about their volatility index on CBOE's website. Some of the more well-known ones are:
ES: S&P futures, which I prefer to the SPX index). Its implied volatility is VIX.
USO: the oil ETF representing WTI future prices. Its IV is OVX.
GDX: the gold miner's ETF, which is usually more volatile than gold. Its IV is VXGDX.
FXI: a china ETF, whose volatility is VXFXI.
And so on. In addition to the premium, the "percentile" column shows where this premium ranks among the previous 252 trading days. 100 = the highest premium, 0 = the lowest premium. Indicator

0_dteUSAGE
This script guages the probability of an underlying moving a certain amount on expiration day, to aid the popular "0 dte" strategy. The script counts how many next-day moves exceeded a given magnitude in the past, under similar conditions. The inputs are:
mark_mode:
- "open": measures the magnitude as "open to close"--a true 0 dte.
- "previous close": for lazy people who don't want to wake up early. measures magnitude from the previous day's close.
move_mode:
- "percent": measures moves that exceed a given percentage.
- "absolute": measures moves that exceed a point value.
move-dir: measure only up moves, down moves, or both.
vol_model: the model for realized volatility. (may add more later).
min_vol: only measure moves when realized vol is above this value.
max_vol: only measure moves when realized vol is below this value.
precision: number of digits printed in the output table.
EXAMPLE:
- mark_mode: "previous close"
- move_mode: "percent"
- move_dir: "up"
- move_mag: 0.07
- vol_model: hv30
- min_vol: 0.2
- max_vol: 0.5
These settings will count the number of trading days that closed 7% higher than the previous day's close, when the previous day's realized volatility (annualized) was between 20% and 50%. The outputs are:
- current vol: green plot. Today's realized vol. Shown for convenience.
- max and min vol: red plots. Also shown for convenience.
- count: the number of days that exceeded the chosen magnitude, when the previous day's realized volatility was within the chosen bounds.
- total: the total number of days where realized volatility was within the chosen bounds
- probability: count / total. the percentage of days that exceeded the move when volatility was within the bounds.
- move: plotted as a purple line. purple "X" labels are plotted above
- bars where the move exceeded the magnitude threshold and volatility was in-bounds. a "hit".
CONCLUSION
This script is based on the idea that realized volatility has some bearing on future volatility. By seeing what happened in the past when volatility was close to its current value, we may be able to assess the probability that our short put will be in the money, tomorrow, and our account devastated.
NOTE: Unlike many of my other scripts, all percentages--both inputs and outputs--are given in fractional form. E.g., 0.01 means 1%. Indicator
