Indicator

TrendSurfer Pro TrendSurfer Pro 🚀
TrendSurfer Pro is a multi-layer trading system built around a core principle: a signal is only valid when multiple independent methods agree. Each component serves a specific, non-redundant role in filtering market noise and identifying high-probability setups.
🧠 How the Components Work Together
The indicator is organized in three layers:
Layer 1 — Trend Context (background conditions)
All signals require alignment with the broader trend before firing. Three independent trend filters run simultaneously:
EMA 750 — long-term directional bias. Bullish signals fire only above it, bearish only below.
Butterworth Filter (2/3-pole) — a zero-lag smoothed trend line that reacts faster than a standard EMA without the noise of raw price. It filters signals that are against the smoothed short-term direction.
VIDYA (Variable Index Dynamic Average) — adapts its smoothing speed to market momentum using a CMO-based efficiency ratio. It is more reactive during trending phases and slower during choppy markets.
These three together define the structural bias. No entry signal fires against all three.
Layer 2 — Entry Signals (timing)
Five signal types identify precise entry points, each using a different market mechanic:
-Master Trend (△▽) — triggers on EMA 4/5 crossover confirmed by RSI > 50 (bull) or < 50 (bear), with price above/below EMA 21, 50, 55, 89, and 750. Engulfing candles on the signal bar are highlighted separately (green/red) to indicate stronger momentum.
-KCandle / Boost (⠾⠻) — detects full engulfing candles where the current bar completely covers the prior bar's range, filtered by EMA 750 side. These identify momentum shifts at key levels and optionally project a "golden area" retracement zone.
-Triangle Signals (▲▼) — fire when the Butterworth Filter changes direction, price is on the correct side of EMA 750 and EMA 25, Stochastic K > 50 (bull) or < 50 (bear), and volume ratio exceeds the threshold. Volume is scaled 1–10 and displayed as a label on the signal bar.
-Order Block Rejections (🟩🟥) — identifies impulsive candles using Z-Score of price change (deviation from SMA of recent changes). When price re-enters the zone of the last opposing candle before the impulse and shows a rejection wick with body outside the zone, a signal fires.
-Liquidity Sweep (✕) — detects when price spikes beyond a pivot high/low (user-defined swing length) and closes back inside. Confirms smart money stop-hunting activity. Also available as a master filter: restrict all other signals to fire only within N bars after a sweep.
Layer 3 — Exit Signals
Take Profit System (🎯) — combines up to 8 indicators (RSI, MACD, Stochastic, Bollinger Bands, Supertrend, CCI, EMA cross, Price Action breakout). A TP signal fires only when the user-defined minimum number of confirmations are met simultaneously (default: 5 of 8). Bearish TP fires above price, bullish below.
Session Rejections (⚡ M) — after a Tokyo, London, or New York session box is drawn, price that breaks above/below the session high/low and then re-enters triggers an External Rejection (⚡). Price that touches and rejects off the session midline triggers an "M" label.
EMA 750 / BF / VIDYA Rejections (R 🟡 🟢🔴) — candles whose wick touches the respective line but whose body remains on the correct side fire a labeled rejection signal. These mark precise dynamic support/resistance touches.
🗂️ Filters
VWAP Filter — restricts signals to the correct side of the daily VWAP
ATR Volatility Score — scores current volatility 1–100 relative to a moving average of ATR. Optionally filter signals below a minimum score.
ATR Channel Mode — creates a dynamic channel around EMA 750 using a long-period ATR multiplier. Signals outside the channel are suppressed.
Yellow Box Filter — isolated stochastic-neutral candles (K between 48–52, not preceded or followed by another neutral candle) generate a yellow rectangle. Signals and KCandle lines are optionally restricted to appear only near these zones.
Time Filters (1/2/3) — three independent session time ranges. Signals fire only within the active windows.
📊 Dashboard Table
The top-right table shows in real time:
EMA 4 vs 5 direction, RSI level, price vs EMA 21/50/55/89/750
Time filter status and active sessions
Buy/Sell volume delta since last VIDYA trend change
ATR value and Vol Score
Overall trend state (VERY BULLISH / BULLISH / BEARISH / VERY BEARISH)
⚙️ How to Use
Set your timezone offset so session boxes align correctly with Tokyo (02:00–08:00 UTC), London (08:00–14:00 UTC), New York (14:00–02:00 UTC).
Choose which master filters to enable (EMA 750, BF, VWAP) based on your timeframe. On lower timeframes (1–5 min), all three recommended. On higher timeframes, BF filter alone may suffice.
Enable the Liquidity Sweep Master Filter if you want to trade only reactive moves after liquidity grabs. Set "Max bars after Sweep" to 3–5 for tight timing.
Use the TP System as an exit confirmation, not an entry. A 🎯 above price after a long entry is the exit signal.
Yellow Box Filter is most useful on 1–5 min charts to avoid trading in random mid-range areas.
Volume label color on Triangle signals: white = standard, orange = high volume (≥9), green = high volume AND price near VWAP — the highest-quality setup.
🔔 Alerts
All signal types have individual alert toggles. Alerts fire once_per_bar_close to avoid repainting. Available alerts: Triangle ▲▼, KCandle, Master Trend, OB Rejection, EMA750/BF/VIDYA Rejection, Session External/Midline Rejection, Liquidity Sweep, TP Bull/Bear, ATR Vol Score. Indicator

Indicator

Quarterly/Monthly/Weekly Performance | Astral Vision Quarterly/Monthly/Weekly Performance | Astral Vision 🌠💠
Price performance measured over fixed trailing windows (7, 30, and 90 bars) captures the momentum of Bitcoin's move at three structurally distinct timescales simultaneously.
Weekly performance reflects short-term trend pressure; monthly performance captures the medium-term cycle direction; quarterly performance reveals whether the broader macro trend is accumulating or distributing. Reading all three in a single panel eliminates the need to switch timeframes to understand where momentum stands across the full temporal structure.
This indicator plots trailing price performance as gradient-filled columns for each active window, with configurable overbought and oversold thresholds that identify statistically extreme moves. All three windows can be active simultaneously or independently, and each drives its own overlay on the price chart through candle coloring or background highlighting.
Calculation ⚙️
`Performance = (close − close ) / close × 100`
Where N is 7, 30, or 90 bars for weekly, monthly, and quarterly windows respectively. The result is a simple trailing percentage return expressed relative to the close N bars ago, with no smoothing applied — preserving the raw momentum read at each timescale.
Plots 📊
Performance columns for each active window (weekly, monthly, quarterly) with gradient fill, opaque at the column tip, fading toward zero
Zero baseline
Overbought and oversold threshold lines for each active window
Background highlight on the price chart when any active window's performance breaches a threshold (Background Color mode)
Candle coloring on the price chart by the sign of the active window's performance (Plot Candle mode)
Inputs 🎛️
`Overlay Mode`: Background Color, Plot Candle, or None for price chart output
`Show Weekly / Monthly / Quarterly`: independent toggles for each performance window
`Weekly OB / OS Threshold`: extreme levels for the 7-bar window (defaults +20 / −15)
`Monthly OB / OS Threshold`: extreme levels for the 30-bar window (defaults +35 / −20)
`Quarterly OB / OS Threshold`: extreme levels for the 90-bar window (defaults +50 / −30)
Colors 🎨
5 Astral Vision presets + custom override. Default: Hermes. Positive color applies when performance is above zero; negative color applies when performance is below zero. Both the column fills and the price chart overlays follow the same coloring logic.
Purpose 🎯
Standard momentum indicators process price through mathematical transformations (RSI, MACD, stochastic) that make their absolute values abstract and cycle-dependent. A trader looking for a direct answer to "how much has Bitcoin moved in the last month?" gets no clean output from any of those tools.
This indicator answers that question directly with no transformation, keeping the output in percentage terms that are immediately interpretable.
The three-window structure lets traders read weekly, monthly, and quarterly momentum in a single panel, identifying divergences between timescales, such as a strong monthly trend with an overextended weekly reading, that single-window indicators cannot surface.
The threshold system identifies when a given trailing return has reached historically extreme levels for that window, providing a contextual signal layer on top of the raw performance read.
Disclaimer ⭕️
It is not financial advice, not an investment recommendation, and not affiliated with any financial institution, research firm, or organization of any kind. All content is provided for educational and informational purposes only. Always conduct your own research before making any financial decision. Indicator

Rolling Sharpe Ratio Oscillator | Astral Vision Rolling Sharpe Ratio Oscillator | Astral Vision 🌠💠
The Sharpe Ratio measures risk-adjusted return: how much excess return is being generated per unit of volatility. Applied as a rolling oscillator to Bitcoin's daily log returns, it answers a question that neither price nor momentum indicators address: is the current appreciation being earned efficiently relative to the risk being taken, or is it a volatile, noisy move that consumes large drawdowns to produce modest gains?
High rolling Sharpe values indicate sustained, low-volatility uptrends where return per unit of risk is structurally elevated, historically coinciding with the most efficient phases of Bitcoin's bull runs. Negative Sharpe values indicate periods where volatility exceeds returns, marking drawdowns and bear phases.
This indicator plots the annualized rolling Sharpe as a smoothed oscillator with configurable thresholds, and back-projects those thresholds onto the price chart as dynamic levels representing the price that would produce each Sharpe extreme given current return and volatility conditions.
Calculation ⚙️
`Log Return = log(close / close )`
`Rolling Sharpe = (SMA(Log Return, length) / StdDev(Log Return, length)) × √365`
The ratio is annualized by multiplying by the square root of 365, expressing it in standard annual terms. An EMA of configurable length is then applied to smooth the raw Sharpe before threshold evaluation and coloring.
The price bands invert the Sharpe thresholds back to price space:
`Band Price = close × exp(threshold × StdDev / √365 × length)`
This produces a dynamic price level representing what price would need to be, given current volatility, to produce the specified Sharpe value.
Plots 📊
Smoothed Sharpe oscillator line in the indicator panel, colored by regime or continuous gradient
Overbought and oversold threshold lines
Fill between oscillator and overbought threshold when breached (distribution zone)
Fill between oscillator and oversold threshold when breached (accumulation zone)
Dynamic overbought and oversold price bands on the price chart, EMA-smoothed
Candle coloring on the price chart by regime or gradient
Background highlight on the price chart when either threshold is active
Inputs 🎛️
`Lookback Period (days)`: rolling window for mean and standard deviation of log returns (default 365)
`Smoothing EMA Length`: EMA applied to the raw Sharpe before all output (default 30)
`Oversold Threshold`: Sharpe level marking risk-adjusted accumulation extremes (default −1.5)
`Overbought Threshold`: Sharpe level marking risk-adjusted distribution extremes (default 2.8)
`Use Gradient Color`: toggles between continuous gradient coloring across the −2 to +2 range and discrete regime-based coloring
Colors 🎨
5 Astral Vision presets + custom override. Default: Futura. In gradient mode, color transitions continuously from negative to positive across the Sharpe range. In discrete mode, positive color activates above the overbought threshold, negative below the oversold threshold, and neutral between them.
Purpose 🎯
Standard momentum indicators like RSI and MACD measure price direction and speed, but are blind to whether that directional move is being achieved efficiently. A 30% Bitcoin rally with 80% annualized volatility carries very different risk-adjusted implications than the same rally with 40% volatility, yet both look identical on a price or momentum chart.
The rolling Sharpe makes that distinction explicit. The price band back-projection eliminates the need to mentally translate Sharpe values into price context: the bands show directly on the chart what price level corresponds to each statistical extreme given current volatility, updating dynamically as the volatility regime evolves.
The gradient coloring option provides a continuous read of risk-adjusted efficiency across the entire oscillator range, not just at binary threshold crossings.
Disclaimer ⭕️
It is not financial advice, not an investment recommendation, and not affiliated with any financial institution, research firm, or organization of any kind. All content is provided for educational and informational purposes only. Always conduct your own research before making any financial decision. Indicator

Convex Hull Channel [forexobroker]🔶 OVERVIEW
Convex Hull Channel forms a tight envelope from the rolling maximum of body-tops (max of open and close) and minimum of body-bottoms (min of open and close), filtering wick spikes that classic Donchian channels reward. An expansion regime, defined as channel width above its 50-bar average, gates breakout signals to high-volatility periods only.
🔶 ALGORITHM
1. body_high = max(open, close); body_low = min(open, close).
2. upper = ta.highest(body_high, N); lower = ta.lowest(body_low, N).
3. width = upper - lower; expansion regime when width >= width_avg * (1 + k).
4. Buy break: close crosses prior bar's upper envelope inside expansion regime.
5. Sell break: close crosses prior bar's lower envelope inside expansion regime.
🔶 SIGNAL LOGIC
- Buy: expansion AND close crosses upper AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: expansion AND close crosses lower AND mirror conditions.
- Position-lock state machine.
🔶 INPUTS
- Envelope Window (default 20)
- Min Width Excess (default 0.20)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, envelope bands, buy / sell colors
🔶 ALERTS
CHC Buy, CHC Sell, CHC Any Signal, CHC Expansion On, CHC Expansion Off, CHC Upper Cross, CHC Lower Cross, CHC Outside, CHC Webhook JSON.
🔶 LIMITATIONS
- Body-only envelope gives fewer false breaks than wick-inclusive Donchian, but can miss legitimate moves that close back inside the body range.
- Expansion regime is rolling-average relative; a long quiet period followed by even modest expansion will fire whereas absolute-width logic might not.
- Cross-of-prior-bar (upper ) introduces a 1-bar delay vs immediate-bar break; intentional, reduces noise.
- Defaults tuned for 15m-1H on majors and indices; very fast scalping timeframes may want a smaller window.
Indicator

Bootstrap Confidence Break [forexobroker]Bootstrap Confidence Break flags bars whose return falls outside a 90 percent confidence interval on the rolling mean return. The CI uses the standard-error formulation that is asymptotically equivalent to the percentile bootstrap when N >= 30, but is fully deterministic — no random number generation, no repainting. Signals fire on EMA cross when the move is statistically significant.
🔶 ALGORITHM
1. r = close - close (single-bar return).
2. mu = sma(r, N); sd = stdev(r, N); se = sd / sqrt(N).
3. CI high = mu + 1.645 * se; CI low = mu - 1.645 * se (90 percent two-sided).
4. Outside-up regime when r > CI_high; outside-down when r < CI_low.
🔶 SIGNAL LOGIC
- Buy: outside-up AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: outside-down AND close crosses EMA down.
- Position-lock state machine.
🔶 INPUTS
- Return Window (default 40)
- Pullback EMA Length (default 8)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors
🔶 ALERTS
BCB Buy, BCB Sell, BCB Any Signal, BCB Outside Up, BCB Outside Down, BCB EMA Up, BCB EMA Down, BCB 2-Sigma, BCB Webhook JSON.
🔶 LIMITATIONS
- Standard-error CI assumes approximately normal returns; heavy-tailed distributions widen the true tail risk and make this more conservative than a true percentile bootstrap.
- 90 percent interval is a reasonable default; adjust the multiplier (1.645) for stricter or looser cutoffs by editing the script.
- Signal cadence depends entirely on volatility regime; quiet markets produce few outside-CI bars.
- Combining CI break with EMA cross dampens whipsaws but slightly delays entry vs raw CI break.
Indicator

Percentile SD OscillatorPercentile SD Oscillator
Percentile SD Oscillator is a momentum oscillator that measures the distance between price and its own dynamic reference levels — derived from percentile bands and a volatility-adjusted standard deviation filter. Rather than using fixed overbought/oversold levels, it continuously adapts to recent price behavior and only confirms a directional state when price demonstrates genuine statistical strength beyond its own boundaries.
The result is a histogram that oscillates around a zero line — positive and blue when the market is in a confirmed bullish state, negative and red when bearish.
How It Works
A moving average of your choice is calculated on a configurable source and length. Two percentile bands are then derived from this MA — an upper band and a lower band — defining the statistical range of recent price behavior.
A standard deviation of the close price is then calculated and added to the lower percentile band, creating a volatility-adjusted long reference level called sd_long. Price must close above both the upper percentile band AND sd_long to confirm a long — requiring double confirmation before entering a bullish state.
For the short side, a simple and fast condition is used — price only needs to close at or below the lower percentile band. Once a short state is confirmed, the oscillator measures the distance between the close price and the upper percentile band plus standard deviation as the bearish momentum value.
An EMA of the oscillator value acts as a confluence filter — the final signal only confirms when the oscillator is not only positive or negative but also above or below its own EMA. This ensures the oscillator only shows a confirmed state when momentum is genuinely building in that direction.
Why This Approach Works
Most momentum oscillators use fixed thresholds that do not adapt to changing market conditions. By combining percentile bands with a close-based standard deviation filter, the Percentile SD Oscillator requires price to break beyond levels that are dynamically calculated from both recent price structure and current volatility.
The asymmetric design between long and short is intentional and reflects the structural reality of markets like crypto. Longs require double confirmation — price must clear both the upper percentile band and the volatility-adjusted SD level — ensuring only genuinely strong bullish moves trigger an entry. Shorts are deliberately simpler and faster — price only needs to break below the lower percentile band, allowing quick exits when support is lost. This asymmetry prevents premature long entries while ensuring fast risk-off behavior when the market weakens.
The bullish momentum is measured against the lower percentile band — this captures how far price has risen above its support zone, giving a direct measure of bullish momentum strength. The bearish momentum is measured against the upper percentile band plus standard deviation — this creates a wider reference that captures how far price has fallen from the resistance zone, giving a more meaningful picture of bearish momentum strength.
Settings
MA Type — Moving average type used as the basis for the percentile calculation: DEMA, EMA, SMA, WMA, HMA, RMA (default: DEMA)
MA Length — Lookback period for the moving average (default: 8)
MA Source — Price source for the moving average calculation (default: high)
Percentile Length — Lookback period for the percentile band calculation (default: 57)
Percentile Up — Upper percentile threshold defining the bullish boundary (default: 60)
Percentile Down — Lower percentile threshold defining the bearish boundary (default: 46)
SD Length — Lookback period for the standard deviation calculation (default: 19)
SD Multiplier — Controls the strength of the standard deviation filter. Set to 0 to disable the SD filter entirely (default: 1.0)
EMA Length — Lookback period for the EMA confluence filter (default: 48)
Background Transparency — Controls the transparency of the optional background color (default: 85)
Color Background — Enables background coloring of the chart based on the current state (default: false)
Use Bar Coloring — Colors bars based on the current state (default: true)
How to trade it
Long — when the histogram turns blue and rises above zero, a bullish state has been confirmed. This is the signal to look for long entries or to hold existing long positions
Short / Cash — when the histogram turns red and falls below zero, the bearish state has been confirmed. This is the signal to exit longs, move to cash, or look for short entries depending on your strategy
Avoid trading against the signal — if the histogram is red do not look for longs, if it is blue do not look for shorts
The EMA line acts as a dynamic reference — when the histogram is above the EMA momentum is building, when it crosses below the EMA momentum is weakening
Recommended Usage
Best used on the 1D timeframe for clean and reliable signal generation
Should not be used alone for trade entries — combine with a trend-following indicator for best results
Set SD Multiplier to 0 to rely solely on the percentile bands — useful when you want more frequent signals in trending markets
Higher SD Multiplier values increase signal quality at the cost of fewer signals — lower values make the indicator more reactive
The asymmetric design makes this oscillator particularly well suited for bullish-biased markets like crypto — long entries require double confirmation while short exits are fast and decisive
All signals are confirmed on bar close. Indicator

Multi-System (RSI2 + Squeeze + MACD/ADX)Confluence Multi-System combines three independent, well-documented signal frameworks into a single overlay and only fires alerts when two or more agree on direction. The goal is to filter noise: each system has its own logic and failure mode, so coincidence between them is statistically rarer and historically higher quality than any individual signal.
THE THREE SYSTEMS
System 1 — Mean Reversion (RSI-2 + Williams %R + 200 SMA)
Larry Connors-style countertrend setup. Trades only in the direction of the 200 SMA trend filter, requires RSI(2) at an extreme (<5 long, >95 short) and Williams %R(10) confirming (<-90 long, >-10 short). Designed for pullbacks within a trend, not reversals against it.
System 2 — TTM Squeeze
Classic John Carter volatility compression setup. Detects when Bollinger Bands(20, 2.0) contract inside Keltner Channels(20, 1.5) — a "squeeze" — then signals on the release in the direction of a linear-regression momentum oscillator. Catches breakouts after consolidation.
System 3 — Triple Confirmation (MACD + RSI + ADX)
Trend-following filter stack. Long requires MACD(12,26,9) bullish cross + RSI(14) > 50 + ADX(14) > 25. Short is the mirror. ADX gates out chop; RSI confirms the cross is in the dominant momentum side.
CONFLUENCE LOGIC
The indicator counts how many systems are signaling in the same direction on the same bar:
• 3/3 → STRONG signal (background tinted, label printed, dedicated alert)
• 2/3 → MEDIUM signal (lighter tint, dedicated alert)
• <2 → no signal, no alert
The minimum number of systems required can be configured (default 2). You can also disable any system individually if you want to test 2-of-2 confluence on specific pairs.
WHAT YOU SEE ON THE CHART
• Background tint on confluence bars (green/red strong, lime/fuchsia medium)
• Labels marking the bar where confluence first appears
• 200 SMA plotted as visual reference for the System 1 trend filter
• A status table (top-right) showing for each system: long/short state, key indicator values (RSI, Williams %R, ADX, squeeze state, momentum), plus a summary row with the current confluence level
ALERTS
Six alertconditions are exposed:
• STRONG LONG (3/3) / STRONG SHORT (3/3)
• MEDIUM LONG (2/3) / MEDIUM SHORT (2/3)
• ANY CONFLUENCE LONG / ANY CONFLUENCE SHORT (respect the configured minimum)
Alerts include ticker, interval, and close price via standard TradingView placeholders.
INPUTS
All three systems are fully parametrized: SMA length, RSI/Williams %R lengths and thresholds, Bollinger and Keltner lengths and multipliers, MACD periods, ADX length and minimum strength. Defaults match the original published values for each framework.
USE CASES
• Day trading on lower timeframes — wait for 2/3 or 3/3 to enter, exit on opposite confluence or your own stop
• Swing trading on 1H/4H/Daily — confluence becomes rare but high quality
• As a confirmation layer over your own strategy — read the table to see which systems agree before pulling the trigger
NOTES AND DISCLAIMERS
This is an indicator, not a strategy — it does not place orders, manage stops, or compute P&L. Win-rate ranges referenced for each underlying system come from the original literature (Connors, Carter, Wilder/Appel) and are heavily dependent on instrument, timeframe, and exit logic. Past performance does not guarantee future results. Always backtest with your own exit rules before trading live.
Open source — fork it, adapt the thresholds, plug in your own systems. Indicator

Regime Classifier : TREND / CHOP / VOL (Multi-Index Tuning)The Big Picture
The Regime Classifier is a single Pine Script that runs on any chart in TradingView and tells you what kind of market you are looking at. It analyzes the recent price action using three independent measurements and combines them into a single label that reads either TREND, CHOP, or VOL. This label appears as a colored tag at the top right of the most recent price bar, with green meaning the market is trending cleanly, red meaning it is choppy and directionless, and orange meaning it is in a high-volatility unstable phase.
The script is designed to be used across multiple charts — one instance on Nifty 50, another on Bank Nifty, another on Midcap 150, and so on for US indices. Each chart instance can be tuned independently from the indicator settings panel without touching the script itself. This is achieved through a configurable inputs section that exposes every important threshold as an adjustable parameter.
How The Script Is Structured
The script is organized into clearly demarcated sections, each separated by horizontal divider lines made of unicode characters. Reading from top to bottom, the sections are: a comprehensive documentation header, the Pine version declaration and indicator title, the inputs section, a position conversion block, the core calculations, the regime logic, the regime label and color assignments, the on-chart label display, the alert condition, a hidden plot for external referencing, and finally the diagnostic table.
This top-to-bottom flow matches the natural reading order. First you understand what the script does (header), then you see how it can be configured (inputs), then you see what it calculates (core calculations), then you see how those calculations are turned into decisions (regime logic), and finally you see how the decisions are displayed and made available (label, alert, plot, table).
The Documentation Header
The first major section of the script is a long block of comments that explains everything a user needs to know before using the indicator. This block is approximately one hundred lines long and is structured into seven distinct parts.
The first part explains what the indicator does in plain language, describing each of the three regimes — TREND, CHOP, and VOL — with their visual signature on the chart and the trading behavior recommended in each. The second part explains how the indicator makes its decisions, walking through the three underlying measurements (ADX, Bollinger Band Width Percentile, and EMA Whipsaw Filter) and explaining why each was chosen and what role it plays.
The third part is a detailed tuning guide showing recommended threshold values for seven different indices spanning Indian and US markets. This table is the most practical piece of documentation in the script because it tells the user exactly which numbers to enter when configuring the indicator on a specific chart.
The fourth part describes the diagnostic table, explaining what each row means and how to interpret the color coding. The fifth part is a deliberate disclosure of the indicator's limitations — what it cannot do, where it lags, and why these limitations are acceptable. The sixth part explains how to set up TradingView alerts using the indicator's built-in alert condition. The seventh part contains author and license information.
This entire header serves as both onboarding documentation for new users and a future reference for the author when revisiting the script after months away.
The Indicator Declaration
After the header comes the Pine version declaration and the indicator title. The script is written for Pine Script version 6, which is the current standard. The title is intentionally region-neutral, reading simply Regime Classifier with the three regime names listed. This neutrality matters because the same script is used across many different markets and indices, so the title should not imply it is specific to any one of them.
The overlay parameter is set to true, which means the indicator draws on top of the price chart rather than creating its own pane below the chart. This is the right choice for an indicator that places labels and tables on the chart but does not plot any price-like values that need their own scale.
The Inputs Section
The inputs section exposes every adjustable parameter to the user through TradingView's settings panel. There are nine inputs in total, organized into four logical groups.
The first input is the Configuration Label, which is a dropdown menu containing eight options corresponding to seven different indices plus a Custom option for any other instrument. This label is purely informational — it does not affect calculations. Its purpose is to give the user a clear visual indicator on each chart of which tuning preset is active. When you have multiple charts open, this label tells you at a glance whether you are looking at the Nifty 50 instance, the Bank Nifty instance, or another configuration.
The second input is the Diagnostic Table Position, which is another dropdown menu with nine options corresponding to the nine standard positions where Pine Script can place a table on a chart. This input lets the user move the diagnostic table to wherever it best fits the chart layout without having to edit the script.
The next group of inputs concerns the ADX calculation. The ADX Length controls the lookback period for the indicator (defaulting to fourteen, the classical value). The ADX Trend Threshold sets the value above which ADX is considered to confirm a trending market. The ADX Chop Threshold sets the value below which ADX contributes to a chop classification.
The third group concerns Bollinger Band Width. The Bollinger Length controls the period for the band calculation. The Bollinger StdDev controls how wide the bands are relative to the middle line. The BBW Percentile Lookback determines how many bars of history the current band width is ranked against. The BBW Volatility Percentile sets the threshold above which the indicator flags VOL.
The fourth group concerns the EMA Whipsaw Filter. The EMA Length sets the period of the moving average used to detect whipsawing. The EMA Whipsaw Lookback determines how many recent bars are checked for crossover counts.
Every input has a tooltip that explains its purpose when the user hovers over it in the settings panel. This makes the indicator self-documenting at the point of use.
The Position Conversion Block
After the inputs comes a small but important block that converts the user's selection from the Diagnostic Table Position dropdown into the actual Pine Script position constant required by the table.new function. The dropdown stores the user's choice as a text string like "Top Right" or "Bottom Left," but Pine Script's table function requires a specific built-in constant such as position.top_right or position.bottom_left.
The conversion block uses an if-else if chain to map each text option to its corresponding constant. The result is stored in a variable called posConstant, which is later used when creating the diagnostic table. This indirection is necessary because Pine Script does not allow dynamic position selection at the table creation point — you cannot pass a string variable directly. The conversion block solves this with a small one-time mapping.
The Core Calculations
This section computes the three underlying measurements that the regime logic depends on.
The first calculation is the ADX. The script uses Pine Script's built-in ta.dmi function, which returns three values — the Plus Directional Indicator, the Minus Directional Indicator, and the ADX itself. The script captures all three but uses only the ADX value for trend strength assessment. The other two are kept available for potential future enhancement but are not currently consumed.
The second calculation produces the Bollinger Band Width. The script first computes the Simple Moving Average over the configured length, then computes the standard deviation of price over the same length, then constructs the upper and lower bands by adding and subtracting a multiple of the standard deviation from the moving average. The band width is calculated as the upper minus the lower, divided by the middle, which normalizes the width to be comparable across instruments at different price levels.
After computing the raw band width, the script ranks it against its own history using the percentrank function. This produces a value between zero and one hundred indicating where the current band width falls compared to the previous one hundred bars (or whatever lookback the user configured). A value of ninety means the current width is wider than ninety percent of recent history, indicating volatility expansion.
The third calculation is the EMA whipsaw count. The script computes a twenty-period exponential moving average, then identifies every bar where price crossed above the EMA (a crossover) or below the EMA (a crossunder) within the recent lookback window. It sums these events to get a total cross count over the lookback. If this count reaches three or more, a boolean flag called isWhipsawing is set to true.
The Regime Logic
This is the heart of the script — the section where the three calculations are combined into a single regime classification. The logic uses three boolean flags computed in a specific priority order.
The first flag is isVol, which is set to true when the BBW percentile rank meets or exceeds the user's volatility threshold. This is checked first because volatility takes priority over everything else in the classification. A market in extreme volatility cannot be considered a clean trend regardless of what ADX says.
The second flag is isTrend, which requires three conditions to all be true. First, the market must not be in VOL state. Second, ADX must be at or above the trend threshold. Third, the whipsaw filter must not be active. Only when all three conditions hold does the indicator classify the market as TREND.
The third flag is isChop, which is the default fallback. It is set to true when the market is neither in VOL nor in TREND, and either ADX is below the chop threshold or whipsawing is active.
This priority structure — VOL first, TREND second, CHOP as fallback — biases the indicator toward conservative classification. If conditions are ambiguous, the indicator defaults to CHOP, which is the regime where the system tells you to stand aside. This bias is intentional because preventing bad trades is more valuable than catching every good one.
The Regime Label, Color, And Code Assignment
After determining which flag is true, the script assigns the appropriate label text, label color, and numeric code to three variables. The label text is one of TREND, CHOP, VOL, or MIXED. The label color is green for TREND, red for CHOP, orange for VOL, and gray for MIXED. The numeric code is one for TREND, negative one for CHOP, two for VOL, and zero for MIXED.
The MIXED state is a defensive fallback that should rarely if ever occur. It exists to handle the theoretical edge case where none of the three primary conditions is true, which can only happen due to floating-point precision issues at exactly the threshold boundaries.
The assignment logic uses if-else if blocks rather than nested ternary expressions. This is a deliberate choice because Pine Script's parser sometimes has trouble with multi-way nested ternaries that mix string and color types. The if-else structure is unambiguous and produces reliable compilation across Pine versions.
The On-Chart Label Display
This section renders the regime classification visually on the chart. The script uses Pine Script's persistent variable mechanism, declaring a label variable with the var keyword that retains its value across bars. On every bar, the script first deletes the previous label and then creates a new one positioned at the high of the current bar.
This delete-and-recreate pattern ensures that only one label exists on the chart at any time, always at the most recent bar. Without this pattern, the script would create a new label on every bar and accumulate hundreds of historical labels, cluttering the chart.
The label uses the style_label_down style, which makes it look like a tag pointing downward at the price bar. The text shows the current regime, the background color matches the regime color, the text itself is white for high contrast, and the size is set to large for visibility.
The Alert Condition
This section enables TradingView users to set up alerts that fire whenever the regime changes from one bar to the next. The script uses Pine Script's history-referencing operator to compare the current regime to the previous bar's regime. When they differ, the regimeChanged boolean is true, and the alertcondition function makes this state available to TradingView's alert engine.
When a user creates an alert in TradingView and selects this script as the source, the Regime Changed condition appears as a selectable trigger. The alert message is a simple text string indicating that the regime has shifted on the current ticker and timeframe. Users can configure delivery via popup, email, mobile push, or webhook depending on their TradingView subscription.
The Hidden Plot
After the alert section, the script includes a single plot statement that outputs the numeric regime code. This plot is hidden from the chart using the display.none parameter, so it does not visually clutter the chart. Its purpose is to make the regime code accessible to other Pine scripts that might want to reference this indicator's output.
For example, if a user later builds a separate strategy script that should only enter trades when the Regime Classifier shows TREND, that strategy can use Pine Script's input source mechanism to read this hidden plot value and gate its trade logic accordingly. The plot is essentially a structured way of exposing the regime decision to downstream automation while keeping the chart clean.
The Diagnostic Table
The final and largest section of the script renders a small information table on the chart showing the indicator's internal state. The table is created once using the var keyword (so it persists across bars) and is positioned according to the user's choice from the Diagnostic Table Position dropdown.
The table has two columns and six rows. The first row shows the Configuration Label, identifying which tuning preset is active on this chart. The second row is a header row labeling the columns as Metric and Value. The remaining four rows show the four diagnostic measurements.
The ADX row displays the current ADX value with two decimal places, color-coded green when above the trend threshold and orange when below. The BBW Rank row shows the current BBW percentile rank, color-coded orange when in volatility territory and white otherwise. The EMA Crosses row shows the count of recent EMA crossings, color-coded red when at or above the whipsaw threshold and white otherwise. The Whipsaw row shows a clean YES or NO indicator with red coloring for YES and green for NO.
The table updates only on the most recent bar by checking the barstate.islast condition. This optimization avoids unnecessary recomputation on historical bars, where the table would not be visible anyway.
The diagnostic table is what makes the indicator transparent rather than a black box. When the user sees a CHOP label and wants to understand why, they can read the table and see exactly which condition is responsible. If ADX is fifteen, the answer is clear — directional momentum has not been confirmed. If Whipsaw is YES, the answer is clear — the market has been crossing the EMA too frequently to be considered trending. This transparency builds user trust in the indicator and helps the user develop intuition about market regime over time.
How The Sections Work Together
Reading the script as a whole, you can trace a clear flow from input to output. The user configures parameters in the inputs section. The position conversion block translates the position selection into the format Pine Script needs. The core calculations transform raw price data into the three measurements (ADX, BBW Rank, Whipsaw count). The regime logic combines these measurements into a single classification. The label and color assignment renders the classification into visible elements. The on-chart label, the alert condition, the hidden plot, and the diagnostic table each consume the classification in different ways — for visual display, for notifications, for downstream automation, and for transparency.
Every section has a single clear purpose. Nothing is duplicated. The script is approximately three hundred lines including comments, but the actual executable Pine code is closer to ninety lines. The comment-to-code ratio reflects the priority on documentation and readability over compactness.
Why It Is Built This Way
The script reflects several deliberate design choices that may not be obvious from reading the code alone.
The choice of three measurements (ADX, BBW Percentile, Whipsaw) rather than one or two reflects the reality that no single technical indicator is reliable across all market conditions. Combining three independent measurements with a priority order significantly reduces the false signals that any one of them would produce alone.
The choice to put the configuration in inputs rather than constants reflects the reality that one set of thresholds cannot fit all markets. A bank index, a tech-heavy index, and a small-cap index have fundamentally different volatility characteristics, and the indicator must be tunable to fit each.
The choice to bias toward CHOP as the default fallback reflects the trading philosophy that protecting capital is more valuable than catching every move. The indicator is designed to keep the user out of bad markets even at the cost of occasionally missing the start of good ones.
The choice to provide a diagnostic table reflects the reality that black-box indicators erode user trust. By showing the user exactly which numbers are driving the classification, the script invites scrutiny rather than blind acceptance.
The choice to write extensive narrative documentation in the comment header reflects the reality that scripts are read by humans, including future versions of yourself, who need to understand the design intent and not just the code mechanics.
These choices add complexity to the script but produce an indicator that is genuinely useful, tunable, transparent, and maintainable.
What This Script Is Not
It is worth noting what this script does not attempt to do. It does not generate buy or sell signals. It does not calculate position sizes. It does not draw entry levels, stops, or targets on the chart. It does not provide a backtesting framework. It does not optimize its own thresholds. It does not access external data feeds.
These omissions are intentional. The script does one thing — classify market regime — and does it cleanly. Other concerns belong in other scripts. A trading system built around this indicator would consist of multiple scripts, each handling a separate concern, with the regime classifier serving as the foundational filter that determines whether the trading system should be active at all.
This separation of concerns is good software architecture in any context. Each script has clear boundaries, can be tested independently, can be improved without breaking other components, and can be replaced if a better version is developed.
In Summary
The Regime Classifier is a Pine Script v6 indicator that classifies any market chart into one of three regimes (TREND, CHOP, VOL) using three independent measurements (ADX, Bollinger Band Width Percentile, EMA Whipsaw Filter) combined with a priority-ordered logic that biases toward conservative classification. It is fully configurable through inputs, transparent through a diagnostic table, deployable across multiple charts with per-chart tuning, alert-enabled for hands-off monitoring, and extensively documented in plain language. It is one component of a larger trading system, focused on the single critical question of whether the current market environment is suitable for trading at all. Indicator

Bitcoin Transaction Fees Z-Score | Astral Vision Bitcoin Transaction Fees Z-Score | Astral Vision 🌠💠
Transaction fees are one of the most direct expressions of genuine on-chain demand pressure. When users compete to get transactions confirmed, fees spike and historically those spikes have aligned tightly with late-stage cycle euphoria. Conversely, fee compression marks periods of network inactivity that have repeatedly preceded major accumulation opportunities.
This indicator standardizes total Bitcoin transaction fees (USD) in log space over a configurable lookback window, producing a Z-Score that exposes statistically extreme deviations from the long-term fee baseline, both to the upside and the downside.
Calculation ⚙️
`Z = (log(SMA(Total Fees USD, smooth)) − SMA(log_fees, length)) / StdDev(log_fees, length)`
Total on-chain fees in USD are first smoothed by a short SMA to reduce daily noise, then transformed into log space before standardization. The Z-Score measures how many standard deviations the current fee level sits above or below its long-term mean, compressing Bitcoin's exponential fee growth into a cycle-comparable signal.
Plots 📊
Z-Score line, colored by active regime (positive, negative, or neutral)
Extreme High threshold line (default 2.5)
Low threshold line (default −1.35)
Fill between Z-Score and Extreme High threshold when breached (distribution zone)
Fill between Z-Score and Low threshold when breached (accumulation zone)
Candle coloring on the price chart by active regime
Background highlight on the price chart when either threshold is active
Inputs 🎛️
`Z-Score Length (days)`: lookback window for mean and standard deviation calculation (default 730)
`Smooth Input (days)` : SMA applied to raw fee data before log transformation (default 7)
`Extreme High Threshold` : Z-Score level marking fee-driven distribution zones (default 2.5)
`Low Threshold` : Z-Score level marking fee-driven accumulation zones (default −1.35)
Colors 🎨
5 Astral Vision presets + custom override. Default: Futura. Positive color activates below the Low threshold; negative color activates above the Extreme High threshold; neutral applies between thresholds.
Purpose 🎯
Raw fee charts are dominated by Bitcoin's exponential price growth, making cycle-to-cycle comparison visually meaningless. Standard fee indicators plot absolute values with no statistical context, offering no signal on whether current fees are elevated or compressed relative to historical norms.
This indicator solves both problems: log transformation removes the exponential trend, and Z-Score standardization makes every cycle directly comparable regardless of Bitcoin's price magnitude. The result is a clean, threshold-driven signal that identifies when fee demand has reached statistically extreme levels, either as a distribution warning or an accumulation opportunity, directly overlaid on the price chart through candle and background coloring.
Disclaimer ⭕️
It is not financial advice, not an investment recommendation, and not affiliated with any financial institution, research firm, or organization of any kind. All content is provided for educational and informational purposes only. Always conduct your own research before making any financial decision. Indicator

R2D2 Liquidation HeatmapR2D2 Liquidation Heatmap: The Professional’s Guide to Trapped Liquidity
Liquidity is the lifeblood of the crypto markets, and more often than not, someone’s forced exit is your ideal entry. In high-leverage environments, price doesn't just move linearly; it moves from one pocket of trapped traders to the next. The R2D2 Liquidation Heatmap is designed to pull back the curtain on these "invisible" price levels, mapping exactly where stop-losses cluster and where market stress is most likely to break.
________________________________________
The Core Philosophy: Trading the "Pain"
Most indicators look at where the price has been. This indicator looks at where the price wants to go to find fuel.
A liquidation cascade occurs when the market hits a dense cluster of stop-orders or liquidation prices. This triggers a self-reinforcing loop: forced sells lead to more price drops, which trigger more sells. By identifying these zones before they are hit, you shift from being a reactive trader to a predictive one.
Heatmap Components
• Current Liquidation Levels: These are "active" zones. They extend to the right of the current price because they represent future targets.
• Historical Liquidation Levels: These are "spent" zones. When a line stops and freezes at a specific bar, it shows you exactly where a flush occurred, giving you a map of how the market responded to that specific injection of volatility.
________________________________________
The Color Spectrum: Decoding Intensity
The heatmap uses a multi-stop gradient to show you the "mass" of the positions at any given level.
Color Meaning Expected Reaction
Dark Purple Low Liquidity Minor speed bump; price may slice through with little effort.
Blue / Indigo Medium Liquidity Potential area for a "pause" or a minor retracement.
Cyan / Light Blue High Liquidity Strong magnet for price; likely to see a spike in volume.
Bright Mint Green Extreme Liquidity High probability of a violent cascade or a major trend reversal.
________________________________________
Professional Trading Strategies
1. The "Liquidity Sweep" Entry
Professional traders rarely buy a support line the first time it’s touched. Instead, they look for the Bright Green cluster sitting just below that support. When price "sweeps" into that green zone and immediately bounces, it indicates that the trapped longs have been flushed out, leaving the path clear for an upside move.
2. Target-Based Exits
If you are in a long position and see a massive Cyan/Green cluster above the current price, that is your exit magnet. These zones act as "liquidity draws." Price is statistically drawn to these areas to facilitate large orders. Setting your Take Profit just inside these clusters ensures you get filled during the peak of the volatility.
3. Avoiding the "Gap"
If you see a large price gap between the current price and the next major liquidation cluster, expect a "slippage zone." Price tends to move very quickly through these low-liquidity areas (Dark Purple) because there are no orders to slow it down.
________________________________________
S caling for Professionals: Timeframe Optimization
The biggest mistake traders make is using the same sensitivity on a 30m chart as they do on a Daily chart. To get a clean, professional-grade heatmap, you must adjust your Cluster Tolerance and Intensity Threshold.
Recommended Settings Table
Timeframe Pivot Length Cluster Tolerance Intensity Threshold
30m - 1HR 3 0.05% - 0.1% 3.0
4HR 3 - 5 0.3% - 0.5% 4.5
Daily 3 1.0% - 2.0% 6.0+
Why the change?
• Cluster Tolerance: On a Daily chart, a "level" is a wide zone. If you keep the tolerance at 0.05%, you will see hundreds of tiny, weak lines. Setting it to 1.5% on the Daily allows the script to aggregate all the stops within a $1,200 range (on BTC), showing you the true macro "wall" of liquidity.
• Intensity Threshold: Daily volume is massive compared to the average. Pushing the intensity to 6.0 or higher ensures that only the most extreme, market-shifting events light up in green, keeping your chart clean and actionable.
________________________________________
Final Tips for Success
• Trust the "Untouched": Significant liquidation levels that haven't been hit for months are often the ultimate "Magnets" for a macro trend.
• Watch the Clusters: If you see three or four lines merging into one thick, bright green bar, pay attention. That is a high-conviction zone where thousands of traders have their "line in the sand."
• Scaling Matters: Always ensure your indicator is pinned to the Right Scale. If the lines don't move when you drag the chart, right-click the indicator name and select "Pin to Scale."
May the trades be with you. Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Volatility Gated Supertrend [BackQuant]Volatility Gated Supertrend
Overview
Volatility Gated Supertrend is a regime-aware trend-following indicator built around a modified Supertrend engine with an integrated volatility filter . Unlike a traditional Supertrend, which flips direction whenever price crosses its trailing bands, this version introduces a gating mechanism that can block trend reversals during low-volatility conditions .
The purpose of the indicator is simple:
Keep the responsiveness and structure of a Supertrend.
Reduce false flips during sideways or compressed conditions.
Allow trend transitions primarily when volatility is expanding enough to justify participation.
The result is a smoother and more selective trend engine designed to suppress whipsaws while still reacting to meaningful directional movement.
The full source structure for the indicator can be referenced here: :contentReference {index=0}
Core idea
Traditional Supertrend indicators work well during directional markets but struggle in compressed environments:
Price repeatedly crosses the trailing bands.
Trend direction flips too frequently.
False reversals appear during chop.
This indicator attempts to solve that problem by asking:
“Is there enough volatility expansion to justify accepting a new trend?”
Instead of blindly allowing every flip, the indicator measures:
Current volatility,
Baseline volatility,
Relative expansion or compression.
Only when volatility conditions are sufficient does the trend engine allow a directional transition.
What the Supertrend is
The Supertrend is a volatility-based trailing trend indicator built from:
ATR (Average True Range)
A central price source
A directional trailing stop structure
The classic logic:
Upper band = price source + ATR × multiplier
Lower band = price source − ATR × multiplier
These bands trail price dynamically:
In bullish conditions, the lower band ratchets upward.
In bearish conditions, the upper band ratchets downward.
When price crosses one of the bands:
The trend flips direction.
This creates a clean directional regime model.
How this version differs
The major difference is the volatility gate .
A normal Supertrend asks:
“Did price cross the band?”
This indicator asks:
“Did price cross the band, and is volatility strong enough to trust the move?”
That additional filter dramatically changes behavior in sideways conditions.
ATR and volatility structure
The indicator uses two ATR measurements:
Fast ATR → current short-term volatility
Slow ATR → baseline long-term volatility
The core ratio:
Volatility Ratio = Fast ATR / Slow ATR
Interpretation:
Ratio above threshold → volatility expansion
Ratio below threshold → volatility compression
This becomes the gate logic.
Volatility Gate Logic
The gate opens only when:
Fast ATR / Slow ATR ≥ Gate Threshold
If volatility is too compressed:
The gate closes.
Trend flips are blocked.
Importantly:
The Supertrend bands still calculate normally.
Price can still cross them.
But the directional state will not update while the gate is closed.
This distinction matters because it means:
The market may technically trigger a reversal,
But the indicator intentionally ignores it if volatility conditions are weak.
Why this helps
Most trend-following systems fail in chop because:
Small meaningless moves trigger directional flips.
There is insufficient range expansion.
The market lacks trend persistence.
By requiring volatility confirmation:
Weak reversals are filtered out.
Trend state becomes more stable.
Noise is reduced.
This makes the indicator particularly useful during:
Low-volatility consolidations,
Mean-reverting conditions,
Slow drifting ranges.
Band construction
The indicator uses:
hl2 as the central source,
ATR for dynamic width,
A configurable multiplier for sensitivity.
Formulas:
Upper Band = hl2 + ATR × multiplier
Lower Band = hl2 − ATR × multiplier
The trailing logic prevents the bands from moving backward unnecessarily:
Bullish lower band only rises.
Bearish upper band only falls.
This creates the staircase-style trailing structure common in Supertrend systems.
Trend state
Trend direction is binary:
1 = bullish
-1 = bearish
A raw bullish flip occurs when:
Close > trailing upper band
A raw bearish flip occurs when:
Close < trailing lower band
However:
The trend only updates if the volatility gate is open.
This is the defining behavior of the script.
Blocked flips
One of the most important features is the visualization of blocked signals .
When:
Price crosses a band,
But volatility is insufficient,
The script:
Plots an X-cross marker,
Keeps the existing trend state,
Refuses the flip.
This gives traders visibility into:
Potential but unconfirmed reversals,
Areas of weak participation,
Fake breakouts or low-energy transitions.
Visual behavior
Trend band
The active trailing band changes color based on trend direction:
Bullish → bullish color
Bearish → bearish color
Gate closed → gated color (dimmed)
Trend fill
The script fills the space between price and the active band:
Bullish fill during bullish regimes
Bearish fill during bearish regimes
This creates a cleaner directional overlay.
Outer glow
An additional glow layer expands slightly beyond the trend band:
Adds directional emphasis,
Improves trend readability,
Visually reinforces active regime.
When the gate closes:
The band and candles dim.
This visually communicates:
“The trend engine is currently suppressing flips.”
Candle coloring
Candles can optionally inherit the trend state:
Bullish regime → bullish candles
Bearish regime → bearish candles
Gate closed → dimmed neutral appearance
This allows the indicator to function as a full-chart regime overlay.
Signal logic
Bullish signal
Occurs when:
Trend flips from bearish to bullish,
AND the gate is open.
Bearish signal
Occurs when:
Trend flips from bullish to bearish,
AND the gate is open.
Blocked signal
Occurs when:
A raw flip condition appears,
BUT volatility ratio is below threshold.
This distinction is important:
A blocked signal is not ignored information.
It is a rejected transition.
How to interpret the gate
Gate open
Volatility is active.
Market expansion is sufficient.
Trend flips are allowed.
Gate closed
Market is compressed.
Conditions are likely choppy.
Trend reversals are suppressed.
This effectively turns the indicator into a:
Trend-following system during expansion,
Trend-holding system during compression.
Why ATR ratio works well
ATR ratio is a powerful regime detector because it measures:
Current volatility relative to normal volatility.
Not just:
“Is volatility high?”
But:
“Is volatility high relative to its recent baseline?”
This adaptive behavior allows the gate to work across:
Different assets,
Different timeframes,
Different volatility environments.
Input guide
ATR Multiplier
Controls band width:
Higher = wider bands, fewer flips
Lower = tighter bands, more sensitivity
ATR Length
Controls volatility calculation for the Supertrend itself.
Fast ATR
Short-term volatility measure.
Slow ATR
Long-term baseline volatility measure.
Gate Threshold
Controls how strict the gate is:
Lower threshold = more permissive
Higher threshold = more restrictive
Example:
0.6 → allows more flips
1.0 → requires current volatility to match baseline
1.2 → requires expansion regime
Strengths
Reduces Supertrend whipsaws in chop.
Adds regime awareness.
Uses adaptive volatility filtering.
Clean trend visualization.
Blocked-signal logic provides extra context.
Limitations
Can delay reversals during early expansion.
Very high thresholds may suppress legitimate transitions.
Still fundamentally a trend-following system.
Not designed for low-volatility mean reversion trading.
Best use case
Volatility Gated Supertrend works best as:
A directional regime filter,
A swing trend overlay,
A volatility-aware trend confirmation tool,
A way to suppress noise during consolidations.
It is particularly useful for traders who:
Like Supertrend logic,
But dislike how often it flips in sideways markets.
Summary
Volatility Gated Supertrend extends the classic Supertrend framework by introducing a volatility-aware gating engine that blocks trend reversals during compressed market conditions. By comparing fast ATR against slow ATR, the script determines whether enough volatility expansion exists to justify a directional transition. The result is a cleaner, more stable trend system that retains the strengths of Supertrend logic while dramatically reducing whipsaws during low-energy market regimes. Indicator

Indicator

Smart Money Liquidity Detector [PickMyTrade]Smart Money Liquidity Detector
This indicator measures market microstructure — the structural signals that institutional activity leaves behind in price and volume data. It combines four academically grounded models into a single Microstructure Stress Score (MSS) ranging from 0 to 100.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MODELS USED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
► Roll (1984)
Synthetic bid-ask spread estimated from the serial covariance of price changes. High Roll spread indicates wider market-maker quotes — historically associated with periods of elevated volatility.
► Corwin-Schultz (2012)
High-low range spread estimator. Uses the relationship between single-period and two-period high-low ranges to back out the effective spread without requiring tick data.
► Amihud (2002)
Illiquidity ratio measuring price move per unit of volume. High Amihud values mean large price impact per dollar traded — a sign of thin order books.
► Kyle Lambda (1985)
Price impact of signed order flow. Derived from the regression of price changes on volume direction. Estimates how aggressively informed participants are moving the market.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MICROSTRUCTURE STRESS SCORE (MSS)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Each model is z-scored over a rolling window, normalised to , then averaged and scaled to 0–100.
MSS = (Roll + Corwin-Schultz + Amihud + Kyle Lambda) / 4 × 100
- MSS > 70 → High stress. Spreads wide, illiquidity elevated, price impact high. Consistent with institutional order flow.
- MSS 30–70 → Normal range. No structural signal.
- MSS < 30 → Low stress. Tight spreads, liquid conditions, quiet tape.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ANOMALY DETECTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Any individual model z-score crossing ±2σ triggers an anomaly flag. Anomaly bars are highlighted in orange on the chart. Roll and Corwin-Schultz anomalies are marked with coloured circles directly on the MSS line.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INPUTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Spread window (default 20) — lookback for Roll and Corwin-Schultz estimation
- Z-score window (default 60) — rolling window for z-scoring all models
- Impact window (default 20) — lookback for Amihud and Kyle Lambda
- MSS normalise window (default 100) — window for normalisation before scoring
- Toggle each model's z-score plot individually
- Highlight anomaly bars on/off
- Info table on/off
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INFO TABLE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Top-right table displays live values and z-scores for all four models, the current MSS reading, and anomaly status on the last closed bar.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Works on any liquid instrument and any timeframe. Most effective on futures, forex, and equity indices where volume data is reliable.
- This indicator does not generate buy or sell signals. It is a market structure diagnostic tool.
- Powered by PickMyTradeLib — PickMyTrade's open quantitative library.
This script is published for educational and informational purposes only. It does not constitute financial advice. Use at your own risk. Past microstructure behaviour does not guarantee future price outcomes.
Indicator

Indicator

Indicator
