A separate-pane indicator that builds a 0 to 100 score from price momentum, nudged by the prior move of a chosen US index and pulled toward 50 in high-volatility regimes.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
58 lines of Pine Script v5 from tradingview/SPE_Regime_ProbProxy.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
SPE_Regime_ProbProxy.pine
// SPE Regime + Probability Proxy (TradingView Pine v5)
// Visual proxy for lab concepts: vol regime + momentum tilt as a 0–100 "P(up) score".
// NOT calibrated Brier-honest logistic output from the Python lab.
//
// Use on any chart symbol. Optional US index for spillover-style context.
//@version=5
indicator("SPE Regime & Prob Proxy", shorttitle="SPE-Prob", overlay=false)
usSym = input.symbol("SPX", "US index (overnight context)")
volWin = input.int(21, "Vol window", minval=5)
momWin = input.int(21, "Momentum window", minval=2)
corrWin = input.int(60, "Corr window", minval=20)
panicQ = input.float(0.80, "Panic vol percentile (approx via SMA rank)", minval=0.5, maxval=0.95)
ret = ta.change(math.log(close))
vol = ta.stdev(ret, volWin)
// Approximate high-vol regime: vol above long SMA of vol
volLong = ta.sma(vol, 100)
regimePanic = not na(vol) and not na(volLong) and vol > volLong * 1.15
regimeElev = not na(vol) and not na(volLong) and vol > volLong * 0.95 and not regimePanic
mom = (close - close[momWin]) / close[momWin]
usClose = request.security(usSym, timeframe.period, close)
usRet = ta.change(math.log(usClose))
corrUs = ta.correlation(ret, usRet, corrWin)
// Simple score 0–100: base 50 + momentum tilt + mild mean-reversion dampener in panic
// Clip-ish using math.min/max
raw = 50.0 + 100.0 * mom * 2.0
// In panic, pull toward 50 (less conviction) and slightly follow US overnight proxy
usTilt = nz(usRet[1], 0) * 200.0
adj = regimePanic ? (raw * 0.5 + 50.0 * 0.5 + usTilt * 0.25) : (raw + usTilt * 0.1)
score = math.max(0.0, math.min(100.0, adj))
plot(score, "P(up) proxy 0-100", color=color.new(color.teal, 0), linewidth=2)
hline(50, "Neutral", color=color.gray)
hline(60, "Lean up", color=color.new(color.green, 60))
hline(40, "Lean down", color=color.new(color.red, 60))
bgcolor(regimePanic ? color.new(color.red, 90) : regimeElev ? color.new(color.orange, 92) : color.new(color.green, 95))
plot(corrUs, "Corr vs US", color=color.orange, display=display.pane)
var table t = table.new(position.bottom_right, 2, 4, bgcolor=color.new(color.black, 70))
if barstate.islast
regTxt = regimePanic ? "PANIC" : regimeElev ? "ELEVATED" : "CALM"
table.cell(t, 0, 0, "SPE Prob Proxy", text_color=color.white, text_size=size.small)
table.cell(t, 0, 1, "Score", text_color=color.gray, text_size=size.tiny)
table.cell(t, 1, 1, str.tostring(score, "#.0"), text_color=color.teal, text_size=size.tiny)
table.cell(t, 0, 2, "Regime", text_color=color.gray, text_size=size.tiny)
table.cell(t, 1, 2, regTxt, text_color=color.white, text_size=size.tiny)
table.cell(t, 0, 3, "ρ US", text_color=color.gray, text_size=size.tiny)
table.cell(t, 1, 3, str.tostring(corrUs, "#.##"), text_color=color.orange, text_size=size.tiny)
// Optional alerts
alertcondition(ta.crossover(score, 60), title="Proxy lean UP", message="SPE proxy crossed above 60")
alertcondition(ta.crossunder(score, 40), title="Proxy lean DOWN", message="SPE proxy crossed below 40")
Overview
Background colours mark calm, elevated or panic volatility, found by comparing recent volatility with its long average. A small table shows the score, regime and correlation. The author states it is a visual proxy and not a calibrated probability.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
US index (overnight context)
symbol
SPX
usSym
Vol window
int
21
volWin
Momentum window
int
21
momWin
Corr window
int
60
corrWin
Panic vol percentile (approx via SMA rank)
float
0.80
panicQ
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line
Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist
MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us
This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl
This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro
The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend