Stochastic Resonance Signal [JOAT]Stochastic Resonance Signal
Introduction
Stochastic Resonance Signal is an open-source indicator built on the physical principle of stochastic resonance — the counterintuitive phenomenon where a moderate level of random noise actually enhances the detection of weak periodic signals rather than degrading it. In trading terms: markets with low volatility noise may suppress trend signals, while a calibrated level of volatility noise can help reveal underlying directional structure.
This indicator computes a signal-to-noise score that normalizes a smoothed price derivative against ATR-based noise. The score peaks when a meaningful directional signal is present within a noise environment that is neither too quiet (which produces false flatness) nor too loud (which obscures the signal entirely).
Core Concepts
1. Signal Component
The raw signal is the smoothed rate of change of price — the first derivative of a filtered price series. An EMA is applied to close to produce a noise-reduced price, then the bar-to-bar difference of that EMA serves as the signal. Positive signal indicates upward momentum; negative indicates downward:
float emaPrice = ta.ema(close, i_signalLen)
float rawSignal = emaPrice - emaPrice
float normSig = rawSignal / (ta.stdev(rawSignal, i_normLen) + 0.0001)
The signal is normalized by its own rolling standard deviation, making it dimensionless and comparable across instruments.
2. Noise Component
Noise is defined as ATR normalized by its rolling standard deviation. This separates the volatility component from the directional component. When noise is very low, it contributes little penalty. When noise is very high, it heavily discounts the signal. The optimal noise range produces the highest SR score:
float noisePenalty = ta.stdev(atrVal, i_normLen) / (ta.sma(atrVal, i_normLen) + 0.0001)
float srScore = math.abs(normSig) / (1.0 + noisePenalty)
3. SR Score and Threshold
The final SR score combines signal strength divided by noise penalty. The score is plotted as a histogram and compared against a configurable threshold. When the score exceeds the threshold in the positive signal direction, a bullish event fires. When in the negative direction, a bearish event fires. Both require barstate.isconfirmed.
4. Regime Context
The indicator categorizes the current noise state as Low, Optimal, or High. The Optimal zone — where stochastic resonance theory predicts signal enhancement — is highlighted in the background. Signals fired during the Optimal noise zone are the primary intended use case.
Features
Normalized signal derivative: EMA-smoothed price rate of change, dimensionless
ATR noise penalty: Volatility normalized by its own distribution, not a fixed threshold
SR Score histogram: Visual representation of the signal-to-noise ratio each bar
Threshold crossover signals: Bull and bear signals when SR score exceeds the gate
Noise regime classification: Low, Optimal, and High noise zones labeled
Optimal zone background: Chart shading during the resonance-optimal noise window
Candle coloring: Candles tinted by current SR score direction and magnitude
Dashboard: Current SR score, signal value, noise level, and regime state
Alerts: Configurable bull and bear SR threshold crossing alerts
Input Parameters
Signal Engine:
Signal EMA Length: Smoothing for price derivative calculation (default: 10)
Normalization Length: Rolling window for z-score normalization (default: 50)
Noise Engine:
ATR Period: ATR length for noise estimation (default: 14)
Optimal Noise Low: Lower bound of optimal noise zone (default: 0.3)
Optimal Noise High: Upper bound of optimal noise zone (default: 0.8)
Signal Gate:
SR Score Threshold: Minimum SR score to fire a signal (default: 1.5)
How to Use This Indicator
Step 1: Identify the Noise Regime
Check whether the background shading is active (Optimal zone). Signals fired during optimal noise conditions have the theoretical backing of stochastic resonance theory behind them.
Step 2: Read the SR Score
A rising histogram above the threshold line in positive territory indicates a developing bullish signal. Crossing below the negative threshold indicates a bearish signal.
Step 3: Apply as a Momentum Filter
Use SR score direction to confirm or reject signals from other tools. An SR score rising strongly above its threshold while a support level holds adds conviction to a long setup.
Indicator Limitations
Stochastic resonance as a trading construct is a theoretical analogy, not a proven quantitative edge on its own
The optimal noise zone boundaries are heuristic; the true optimal noise level varies by instrument and timeframe
Normalization requires a minimum lookback before scores stabilize — expect less meaningful output in the first normLen bars
Originality Statement
The application of stochastic resonance theory to price signal detection — computing a signal-to-noise ratio using a normalized price derivative divided by an ATR noise penalty, with an explicit optimal noise zone classification — is an original analytical framing not found in existing published Pine Script indicators. This is not a standard oscillator; it is a physics-inspired signal processing approach adapted to price data.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. The stochastic resonance framework is a conceptual model and does not guarantee profitable signals. Trading involves substantial risk of loss.
-Made with passion by jackofalltrades
Indicator

Keltner Channel ATR StretchKeltner Channel ATR Stretch is a Keltner Channel variant designed to show trend bias, price stretch, and volatility width in one compact view.
The script uses an EMA basis with ATR-scaled upper and lower bands. In addition to the channel itself, it normalizes the selected Source's distance from the EMA basis as Stretch, normalizes the EMA basis slope in ATR units as Bias, and ranks the current channel width against its recent min-max range as Width Rank.
The goal is not to create trade signals. The goal is to make the current chart state easier to read: whether price is inside the channel, moving with a trend bias, pulling back toward the basis, stretching beyond the outer band, reaching an extreme band, or returning inside the channel after an outside move.
Dashboard reading:
Bias shows the EMA basis direction normalized by ATR:
Bullish, Bearish, or Neutral.
Position shows where the selected Source is relative to the channel:
Trend Zone, Pullback, Upper Stretch, Lower Stretch, Extreme, or Inside.
Volatility shows the current channel width regime:
Quiet, Normal, or Expanded.
Stretch shows the distance from the EMA basis in outer-channel units.
A value near +1 means price is near the upper outer band.
A value near -1 means price is near the lower outer band.
Slope shows the EMA basis slope in ATR units.
Width Rank shows the current channel width relative to its recent min-max range.
It is a simple 0-100 rank of the current width inside its own recent range, not a statistical percentile.
How it works:
The basis is an EMA of the selected Source.
The outer bands are calculated as:
Basis plus or minus ATR multiplied by the ATR Multiplier.
The inner bands are a fractional zone inside the outer channel.
The optional extreme bands are a wider reference zone outside the outer channel.
Stretch is calculated as:
Source minus Basis, divided by the outer channel half-width.
Slope is calculated as:
Current EMA basis minus the basis from the selected lookback, divided by ATR.
Width Rank compares the current channel width to the lowest and highest channel width over the selected Width Rank Lookback.
Markers and alerts:
Upper stretch and lower stretch mark movement beyond the outer bands.
Upper extreme and lower extreme mark movement beyond the optional extreme band level.
Upper return inside and lower return inside mark when the selected Source moves back inside the outer channel after being outside it.
Trend bias changed marks a change in the ATR-normalized EMA basis direction.
Width regime changed marks a change between Quiet, Normal, and Expanded width states.
The Confirmed bars only setting is enabled by default. When it is enabled, markers and alerts evaluate only on closed bars. The dashboard reflects the current chart state, including the still-forming bar.
This is not a trading system. It is a visual analysis tool for reading channel position, trend bias, and volatility context. It does not provide trade instructions, entries, exits, or performance claims.
Limitations:
Keltner Channels are volatility-based bands and can expand or contract as ATR changes.
A stretch beyond a band does not necessarily mean price must reverse.
A quiet width regime does not guarantee expansion.
A bullish or bearish bias does not predict future direction.
Use this tool together with your own market context and risk management.
No financial advice.
This open-source script was written from scratch using Pine Script built-ins. No third-party Pine code was reused.
日本語補足:
Keltner Channel ATR Stretch は、EMAを中心にATR幅のチャネルを表示しながら、価格の伸び、EMAの傾き、チャネル幅の状態を同時に確認するためのインジケーターです。
右上のDashboardでは、Bias、Position、Volatilityを中心に、現在のチャート状態をすばやく確認できます。
Bias はATRで正規化したEMAの傾きです。
Position は価格がチャネル内、トレンドゾーン、押し目、上方向または下方向の伸び、極端な伸びのどこにあるかを示します。
Volatility はチャネル幅がQuiet、Normal、Expandedのどの状態にあるかを示します。
このスクリプトは売買システムではありません。
BUY/SELL、エントリー、利確、損切りを指示するものではなく、トレンド・行き過ぎ・ボラティリティの状態を読みやすくするための視覚補助ツールです。 Indicator

Volatility Trail [BOSWaves]Volatility Trail - Hull-Anchored ATR Trail with Gradient Cloud Radiation and Multi-Mode Candle Scoring
Overview
Volatility Trail is a Hull-anchored trend trailing system that constructs an ATR-scaled ratcheting trail from a Hull Moving Average baseline, where trend state, gradient cloud geometry, and candle coloring intensity are driven by the relationship between price and the adaptive trail rather than by fixed thresholds or static band crossovers.
Instead of relying on conventional moving average crossovers or symmetric bands, trend state is determined by a one-directional ratcheting trail that advances in the trend direction and locks in progress, only flipping when price closes through the trail level in the opposing direction. The trail distance from the Hull baseline scales with ATR, ensuring the ratchet respects current volatility conditions rather than applying a fixed distance regardless of market behavior.
This creates a trailing trend framework that combines a responsive Hull baseline with a volatility-calibrated ratchet mechanism, a radiating four-layer gradient cloud that visually maps the space between trail and price, and a configurable candle coloring system that scores each bar by distance from the trail, trail acceleration, or both, producing a chart where candle brightness communicates conviction intensity rather than merely indicating direction.
Price is therefore evaluated not just for its position relative to the trail but for how far it has extended from it and how fast the trail itself is advancing, providing a multi-dimensional conviction reading through the visual layers of the indicator.
Conceptual Framework
Volatility Trail is founded on the principle that a trailing trend system should do three things simultaneously: define trend state through a ratcheting mechanism that locks in directional progress, communicate the spatial relationship between price and the trail through a graduated visual field, and score candle conviction based on measurable characteristics of that relationship rather than applying uniform coloring regardless of momentum state.
Traditional trailing indicators provide a line that defines trend direction but offer no framework for understanding how convincingly price is separated from that line or whether the trail itself is accelerating. This framework adds those dimensions through the gradient cloud and candle scoring systems, transforming a single trail line into a complete visual conviction map that reveals both where price is relative to the trail and the dynamic quality of the separation between them.
Three core principles guide the design:
The trail should ratchet in the trend direction using ATR-scaled distance from a Hull baseline, locking in progress and only reversing when price demonstrates a genuine closing breach rather than a temporary excursion.
The space between the trail and price should be visualized as a graduated gradient field with multiple opacity layers that radiates from the trail toward price, communicating proximity and separation depth visually rather than numerically.
Candle coloring should reflect measurable conviction characteristics through configurable scoring modes, dimming bars with weak conviction and brightening bars with strong distance or acceleration readings to encode momentum quality into the candlestick display.
This shifts trailing trend analysis from single-line direction tracking into a multi-layer conviction visualization where the trail, cloud, and candles collectively communicate trend state, spatial conviction, and momentum quality simultaneously.
Theoretical Foundation
The indicator combines Hull Moving Average baseline construction, ATR-scaled ratcheting trail mechanics, four-layer gradient cloud construction using proportional gap interpolation, and a dual-mode candle scoring system based on distance normalization and trail acceleration measurement.
The Hull Moving Average provides a low-lag directional baseline that reduces the smoothing delay of standard moving averages while maintaining noise resistance. The trail ratchets by advancing the lower band as a minimum during uptrends and the upper band as a maximum during downtrends, preventing the trail from retreating against price and locking in each bar's progress. The gradient cloud divides the gap between trail and price into four proportionally spaced bands at 20, 40, 65, and 85 percent of the total gap, filling each interval with progressively increasing transparency to create a radiating visual field. Candle scoring normalizes either distance from trail or trail advancement speed against ATR, applies a power transformation to suppress weak readings, and maps the result to a gradient between a neutral dim color and the full trend color.
Four internal systems operate in tandem:
Hull ATR Trail Engine : Calculates the Hull MA baseline and derives upper and lower ATR-scaled bands, maintaining a ratcheting trail that advances with the trend and flips to the opposing band only when price closes through the current trail level.
Gradient Cloud System : Computes four proportional interpolation points between the smoothed trail and price, plots invisible bands at each point, and fills the intervals with opacity-graduated fills that intensify near the trail and fade toward price, producing a radiating cloud effect.
Candle Scoring Engine : Measures distance from trail normalized by ATR and trail advancement speed normalized by ATR fraction, applies a power exponent to crush weak scores, and maps the resulting score to a gradient from a dim neutral color to the full trend color through configurable distance, acceleration, or combined scoring modes.
Retest Detection System : Monitors price proximity to the trail after the signal buffer period, triggering retest diamonds when price approaches within an ATR-fraction zone of the trail without crossing it, with per-side cooldown enforcement between consecutive signals.
This design allows the trail to provide clean directional state through ratcheting mechanics while the cloud and candle systems layer spatial and momentum conviction context onto the same chart space.
How It Works
Volatility Trail evaluates price through a sequence of trail-aware and conviction-scoring processes:
Source Selection : The price source used for Hull calculation and trail comparison is selected from Close, HL2, HLC3, or OHLC4, allowing the baseline to be anchored to the most appropriate price representation for the target instrument.
Hull Baseline Calculation : The Hull Moving Average is calculated over the configured length from the selected source, providing a low-lag directional reference that minimises the lag penalty of standard moving averages.
ATR Band Derivation : Upper and lower bands are calculated by adding and subtracting ATR multiplied by the configured factor from the Hull baseline, producing volatility-scaled boundaries that adapt to changing market conditions.
Trail Ratcheting : During an uptrend the trail advances as the maximum of the lower band and the prior trail, preventing retreat against price. During a downtrend it advances as the minimum of the upper band and the prior trail. When price closes through the current trail the trend flips and the trail resets to the opposing band.
Trail Display Smoothing : An EMA smoothing pass over the configurable length is applied to the trail for display purposes, producing a visually cleaner line while signals continue to fire from the raw unsmoothed trail.
Gradient Cloud Construction : The gap between the smoothed trail and close is calculated and four interpolation points are derived at proportional fractions of that gap. Each interval between adjacent points is filled with a directional color at progressively increasing transparency, producing a graduated cloud that radiates from the trail outward toward price.
Distance Scoring : The absolute distance between close and the smoothed trail is divided by three times ATR to produce a normalized 0-1 distance score, measuring how far price has extended from the trail relative to recent volatility.
Acceleration Scoring : Trail advancement speed is measured as the absolute change in trail position over the acceleration lookback, normalized by a fraction of ATR, producing a 0-1 score reflecting how quickly the trail is currently advancing.
Score Combination and Power Transform : Depending on the selected candle mode, the distance score, acceleration score, or their maximum is selected, then raised to the power of 2.5 to suppress low-conviction readings and concentrate brightness at genuinely strong bars.
Candle Color Mapping : The transformed score maps from a fixed dim neutral color at zero to the full trend color at one, producing candles that are nearly invisible during low-conviction conditions and fully saturated during strong extension or acceleration events.
Retest Diamond Detection : After the signal buffer period from the most recent flip, price approaching within a fraction of ATR of the trail without crossing it triggers a directional retest diamond, with per-side cooldown enforced between consecutive signals.
Together, these elements form a continuously updating trail system where ratcheting mechanics define direction, gradient cloud layers map spatial conviction, and candle scoring communicates momentum quality across every bar of the trend.
Interpretation
Volatility Trail should be interpreted as a ratcheting trend system with radiating conviction geometry and multi-mode candle intensity scoring:
Bullish Trend State (Green) : Active when the trail has ratcheted below price and price has not closed below it, with the gradient cloud radiating upward from the trail toward the current bar.
Bearish Trend State (Red) : Active when the trail has ratcheted above price and price has not closed above it, with the gradient cloud radiating downward from the trail toward the current bar.
Trail Line : The smoothed ratcheting trail provides the primary directional boundary, advancing with the trend and serving as the structural invalidation level for the current directional state.
Gradient Cloud : Four fills between the trail and price create a radiating opacity field that intensifies near the trail and fades toward price, visually encoding the spatial relationship between the ratchet boundary and current price action. A thick, prominent cloud indicates substantial separation, while a thin cloud suggests price is close to the trail and near potential retest territory.
Distance Mode Candles : Candle brightness reflects how far price has extended from the trail relative to ATR. Bright candles indicate substantial separation, dim candles indicate proximity to the trail.
Acceleration Mode Candles : Candle brightness reflects how fast the trail itself is advancing. Bright candles indicate the trail is moving quickly with the trend, dim candles indicate the trail is stalling.
Both Mode Candles : Candle brightness reflects the maximum of distance and acceleration scores, brightening when either strong extension or strong trail advancement is present.
▲ Buy Signals : Green triangles mark upward trail flips where trend has switched from bearish to bullish and the trail has reset to the lower ATR band.
▼ Sell Signals : Red triangles mark downward trail flips where trend has switched from bullish to bearish and the trail has reset to the upper ATR band.
◆ Retest Diamonds : Small diamonds plotted below bars during bullish retests and above bars during bearish retests when price approaches within the retest zone of the trail after the signal buffer period, identifying potential continuation interaction points with the trailing boundary.
Trail position, cloud depth, candle brightness, and retest diamond placement collectively provide more conviction information than trend direction alone.
Signal Logic & Visual Cues
Volatility Trail presents two primary trail flip signals alongside continuous retest zone monitoring:
Buy Signal (▲) : Green triangle appears when the trail ratchet flips from bearish to bullish, indicating price has closed above the upper ATR band and the trail has reset to the lower band to begin a new bullish ratchet cycle.
Sell Signal (▼) : Red triangle appears when the trail ratchet flips from bullish to bearish, indicating price has closed below the lower ATR band and the trail has reset to the upper band to begin a new bearish ratchet cycle.
Retest diamond detection provides continuous secondary monitoring, marking proximity to the trail after the signal buffer period with independent per-side cooldown enforcement, identifying potential continuation setups at the ratchet boundary throughout the established trend.
Alert generation covers bullish and bearish trail flips and both bullish and bearish retest events for systematic trend monitoring workflows.
Strategy Integration
Volatility Trail fits within volatility-adaptive trailing and momentum conviction approaches:
Trail Flip Entries : Use trail flip signals as primary trend initiation triggers where price has closed through the ATR-scaled boundary and the ratchet has reset in the new direction, with the newly positioned trail providing an immediate structural invalidation reference.
Candle Mode Selection for Instrument Type : Use Distance mode on instruments where price extension from the trail is the primary conviction indicator, Acceleration mode on instruments where trail advancement speed is more consistent, and Both mode for instruments where either characteristic can signal high conviction depending on market phase.
Cloud Depth Assessment : Use gradient cloud depth as a real-time spatial conviction reading. A deep cloud with multiple visible layers indicates substantial separation and trend momentum. A thin cloud with minimal fill depth indicates price is compressing toward the trail and a retest is increasingly probable.
Retest Diamond Re-entry : Use retest diamonds as lower-risk continuation entry references within established trends, entering in the trend direction when price approaches the trail boundary after the signal buffer period rather than chasing extended price action far from the trail.
ATR Factor Calibration : Adjust the ATR factor to match the instrument's typical volatility behavior at the target timeframe, using higher factors for instruments requiring more room between price and trail and lower factors for tighter ratchet tracking.
Multi-Timeframe Trail Alignment : Apply higher-timeframe trail direction as a bias filter, engaging with lower-timeframe flip signals and retest diamonds only when they align with the established higher-timeframe ratchet direction.
Technical Implementation Details
Core Engine : Hull Moving Average baseline with configurable source and ATR-scaled ratcheting trail mechanics
Trail Logic : One-directional ratchet advancing as band maximum or minimum in respective trend directions with flip on close breach
Gradient Cloud : Four proportional gap interpolation points with interval fills at graduated transparency levels radiating from trail toward price
Candle Scoring : ATR-normalized distance and acceleration scoring with power transform and gradient mapping to dim-to-trend-color range
Retest System : ATR-fraction proximity zone detection with signal buffer and independent per-side cooldown enforcement
Visualization : Smoothed trail line, four-layer gradient cloud fills, flip signal labels, retest diamond markers, and multi-mode intensity-scored candle coloring
Signal Logic : Raw trail flip detection with smoothing applied to display only, preserving signal timing accuracy
Performance Profile : Optimized for real-time execution across all timeframes with stateful trail variable maintaining ratchet progress between bars
Optimal Application Parameters
Timeframe Guidance:
1 - 5 min : Intraday trail tracking for scalping with shorter Hull length and tighter ATR factor for fast ratchet response to intraday momentum shifts
15 - 60 min : Session-level trend identification with balanced Hull length and moderate ATR factor for reliable directional framing across typical session moves
4H - Daily : Swing-level trailing with longer Hull length and higher ATR factor for sustained ratchet persistence across multi-session directional moves
Suggested Baseline Configuration:
Hull Length : 72
ATR Length : 9
ATR Factor : 1.7
Source : Close
Trail Smoothing : 4
Show Gradient Cloud : Enabled
Color Candles : Enabled
Candle Color Mode : Distance
Show Buy/Sell : Enabled
Retest Diamonds : Enabled
These suggested parameters should be used as a baseline; their effectiveness depends on the instrument's volatility characteristics, Hull responsiveness at the target timeframe, and preferred signal frequency, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
Trail flips too frequently : Increase ATR Factor to widen the distance between the Hull baseline and the trail boundary, requiring more significant price displacement before a flip is registered.
Trail flips too slowly : Decrease ATR Factor toward 0.5 for a tighter trail that responds faster to directional changes, or decrease Hull Length for a more reactive baseline.
Hull baseline too laggy : Decrease Hull Length toward 20 for a faster baseline that captures directional shifts earlier, accepting increased sensitivity to short-term price fluctuations.
Hull baseline too reactive : Increase Hull Length for a smoother baseline that filters minor oscillations and produces a more stable trail ratchet with fewer noise-driven flips.
Candles too uniformly dim : Switch to Acceleration mode if the instrument's trail advancement speed is more variable than its price extension, or reduce ATR Factor so distance scores normalize against a tighter trail range.
Too many retest diamonds : Increase Retest Cooldown to enforce greater bar separation between consecutive diamond markers, or increase Signal Buffer to delay retest detection further from each flip event.
Retest diamonds not firing : The retest zone is sized as a fraction of ATR multiplied by the ATR Factor. On instruments with very consistent trail distance this zone may be narrow. Increasing ATR Factor slightly widens the retest detection zone relative to the trail boundary.
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
Trending markets with sustained directional moves where the Hull baseline advances consistently and the trail ratchets without frequent resets, producing deep gradient clouds and bright high-conviction candles throughout the move
Instruments with consistent ATR behavior where the volatility-scaled trail distance produces reliable flip signals without excessive noise-driven reversals
Momentum continuation strategies that benefit from the retest diamond system identifying pullback interactions with the trail boundary as lower-risk continuation entry points
Multi-mode candle scoring approaches where distance or acceleration scoring provides additional conviction context that supplements the directional trail signal
Reduced Effectiveness:
Choppy, low-momentum markets where price oscillates near the Hull baseline, causing frequent trail flips and preventing the ratchet from establishing meaningful directional progress
Extremely volatile instruments where ATR spikes produce wide trail distances that delay flip detection relative to the actual structural change in price direction
Consolidation environments where the Hull baseline moves sideways and the trail ratchet stalls, producing minimal cloud depth and uniformly dim candles without directional conviction scoring
News-driven or gap-heavy markets where instantaneous price displacements trigger trail flips that immediately reverse before the ratchet can establish sustained directional progress
Mean-reversion dominant conditions where trail flips occur rapidly in alternating directions without the sustained follow-through required for gradient cloud development or sequential retest patterns
Integration Guidelines
Confluence : Combine with BOSWaves structural tools, order flow analysis, or momentum oscillators to validate trail flip signals with broader analytical context before committing to directional positions
Cloud Depth Monitoring : Track gradient cloud depth evolution throughout the trend as a spatial conviction indicator. Progressively deepening cloud layers suggest sustained separation and trend health while thinning cloud depth warns of price compression toward the trail and potential retest or flip conditions.
Candle Mode Selection : Match the candle scoring mode to the instrument's typical conviction expression. Instruments that show conviction through large extension moves favor Distance mode; instruments that show conviction through accelerating trail advancement favor Acceleration mode; instruments that express conviction through either mechanism favor Both mode.
Ratchet Progress Awareness : Recognize that the trail only advances and never retreats against price within a trend. Rapid trail advancement reflected in bright Acceleration mode candles indicates strong directional follow-through, while a stalling trail with minimal advancement suggests momentum is flattening before potential reversal.
State Discipline : Maintain directional bias aligned with the current trail trend state until a confirmed closing breach of the trail triggers a flip. Retest diamonds and cloud thinning within an established trend represent continuation context rather than reversal signals and should not override the ratchet-defined directional state.
Disclaimer
Volatility Trail is a professional-grade Hull-anchored trend trailing and conviction visualization tool. It uses ATR-scaled ratcheting trail mechanics with gradient cloud construction and multi-mode candle scoring but does not predict future price movements. Results depend on market conditions, instrument volatility characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates order flow context, structural analysis, and comprehensive risk management. Indicator

Adaptive Volatility Envelope [QuantAlgo]🟢 Overview
The Adaptive Volatility Envelope wraps price in a dynamic field of volatility bands centred on a self-adjusting baseline. Rather than tracking price at a fixed speed, the centerline measures how efficiently price is moving and accelerates when movement is more directional while slowing down in choppy conditions, so the baseline follows sustained moves more closely and reacts less to sideways noise. Around this adaptive centerline, layered ATR-scaled bands form a heat map that brightens toward the side price is moving into, giving traders a visual read on both trend state and momentum strength across any instrument or timeframe.
🟢 How It Works
The indicator's core methodology combines two mechanisms: an efficiency-driven centerline that adapts its tracking speed to market conditions, and a volatility-scaled band field that visualises momentum through colour and brightness.
First, market efficiency is measured by comparing net directional movement against total movement over the adaptation window. This ratio approaches one when movement is more directional and falls toward zero in choppy conditions, and it is used to blend between a slow choppy speed and a fast trending speed. The result is a smoothing factor that automatically tightens the centerline's tracking in directional moves and loosens it in noise, without manual recalibration:
efficiencyRatio = totalMovement != 0 ? priceChange / totalMovement : 0.0
smoothingFactor = choppySpeed + (trendSpeed - choppySpeed) * efficiencyRatio
Next, the centerline advances toward price by the smoothing factor on each bar, producing an adaptive baseline that closes the gap quickly when efficiency is high and slowly when it is low:
centerline := na(centerline ) ? src : centerline + smoothingFactor * (src - centerline )
Band width is then derived from Average True Range scaled by the band spacing, with a safety cap that measures total envelope height against the recent fifty bar price range. If the raw width would exceed this cap, every band is scaled down proportionally, preventing the field from blowing out and distorting the chart scale during volatility spikes:
widthScale = rawWidth > maxWidth and rawWidth != 0 and maxWidth > 0 ? maxWidth / rawWidth : 1.0
bandUnit = atr * bandSpacing * widthScale
Momentum is resolved from the centerline's slope normalised by ATR and scaled by the colour sensitivity, then clamped to a range of minus one to one. This drives a gradient that runs from the neutral colour at flat momentum toward the bullish or bearish colour as the move strengthens, while a directional brightness offset lights up the leading side of the envelope more than the trailing side:
momentumRaw = not na(atr) and atr != 0 ? slope / atr * colorSens : 0.0
momentum = math.max(-1.0, math.min(1.0, momentumRaw))
Finally, a confirmed-bars toggle governs what the script computes. In Live mode the centerline, momentum, bands and signals update intrabar on the developing bar for the fastest response, with the current bar able to change until it closes. In Confirmed mode everything is locked to closed bars only, so signals do not repaint and print on the bar that closes the move.
🟢 Signal Interpretation
▶ Bullish Momentum (Centerline and Bands Brightening Toward the Bullish Colour): When the centerline slopes upward relative to volatility, momentum turns positive and the envelope gradient shifts toward the bullish colour. The leading upper side of the field brightens through the directional brightness offset, making the direction of the move easier to read. The bullish state persists as long as the centerline continues rising, and a "Momentum Turned Bullish" alert fires on the bar where momentum crosses above zero.
▶ Bearish Momentum (Centerline and Bands Brightening Toward the Bearish Colour): When the centerline slopes downward relative to volatility, momentum turns negative and the gradient shifts toward the bearish colour, with the leading lower side of the field brightening to flag the downturn. As with the bullish state, the colour saturates as the move strengthens and fades toward neutral as momentum flattens. A "Momentum Turned Bearish" alert fires on the bar where momentum crosses below zero, flagging a potential short or exit condition.
▶ Neutral Momentum (Centerline and Bands at the Neutral Colour): When the centerline is flat or moving slowly relative to volatility, momentum sits near zero and the gradient settles at the neutral colour at the middle of its range. This indicates low conviction or sideways drift rather than a directional move, and the envelope brightens away from neutral only as the slope steepens enough to register on either side. Reading the neutral state helps separate genuine momentum from chop, since the field stays muted until price generates a meaningful directional slope.
🟢 Features
▶ Preconfigured Presets: Three parameter sets cover a range of trading styles and timeframes. "Default" delivers a balanced engine for swing trading on 4-hour and daily charts. "Fast Response" shortens the adaptation window and quickens both market speeds for tighter, more reactive bands on 5-minute to 1-hour charts, suiting intraday and scalping use. "Smooth Trend" lengthens the adaptation window and slows the speeds for wider, steadier bands on daily and weekly charts, suiting position trading. The presets deliberately leave Volatility Length untouched, so band width stays under independent manual control.
▶ Built-in Alerts: Three alert conditions support automated monitoring of momentum transitions. "Momentum Turned Bullish" fires on the bar momentum crosses above zero. "Momentum Turned Bearish" fires on the bar momentum crosses below zero. "Any Momentum Change" triggers on either transition for traders who want a single unified alert regardless of direction. All alerts include the exchange, ticker, and timeframe in the message for immediate context, and the confirmed-bars toggle determines whether they evaluate on live or closed-bar data.
▶ Visual Customisation: Six colour presets, Classic, Aqua, Cosmic, Cyber, Neon, and Custom, provide coordinated bullish and bearish colour pairings suited to different chart themes and personal preferences. Selecting Custom exposes independent colour pickers for full manual control over both states, alongside an adjustable neutral colour for the midpoint of the gradient. The number of band layers is configurable from one for a clean minimal look up to eight for a rich gradient field, and the bands can be hidden entirely to display only the centerline. Optional bar colouring tints price candles with the active trend colour at a configurable transparency level, reflecting the current momentum state without reading the centerline directly.
Indicator

Indicator

Impulse Memory Engine [JOAT]Impulse Memory Engine is an open-source Pine Script v6 overlay that measures fresh displacement, stores directional memory with exponential decay, and displays adaptive retest rails after significant impulse bars. It is built to answer a simple question: is the most recent meaningful impulse still fresh enough to matter?
The script blends MAD-style distance, ATR, trend basis, and decay memory. This creates a visual layer that distinguishes fresh impulse, fading impulse, and reset conditions while keeping the chart clean.
Core Concepts
1. MAD and ATR Normalized Displacement
The script estimates a robust distance unit using median absolute deviation and ATR. The impulse score is the one-bar displacement divided by this unit.
medianSource = ta.median(sourceInput, madLengthInput)
madDistance = ta.median(math.abs(sourceInput - medianSource), madLengthInput)
unitDistance = math.max(atrValue * 0.35, madDistance * 1.4826)
impulseRaw = safeRatio(sourceInput - sourceInput , unitDistance)
2. Trend Basis and Fast Track
A slower EMA defines the trend basis while a faster EMA tracks near-term movement. The distance between them contributes to the heat score.
3. Freshness Decay
When a bullish or bearish impulse appears, the script measures bars since that impulse and applies exponential decay. Fresh impulses have more weight; older impulses fade naturally.
bullBars = ta.barssince(bullImpulse)
bearBars = ta.barssince(bearImpulse)
bullFresh = na(bullBars) ? 0.0 : math.exp(-bullBars / decayLengthInput)
bearFresh = na(bearBars) ? 0.0 : math.exp(-bearBars / decayLengthInput)
memorySigned = bullFresh - bearFresh
4. Adaptive Bands
The trend band widens when memory strength increases. This helps separate quiet reset states from active impulse regimes.
5. Retest Rails
After a fresh impulse, the script stores a rail near the impulse bar. A confirmed retest occurs when price revisits the rail while memory remains directionally active.
Features
Impulse score: Measures displacement relative to MAD and ATR distance
Memory decay model: Tracks whether the last strong impulse is fresh or fading
Adaptive trend cloud: EMA basis and fast track are filled by memory state
Dynamic bands: Band width expands with volatility and impulse memory
Retest rails: Bull and bear rails remain visible for a configurable window
Rail labels: Active bull and bear rails are labeled at the right edge with spacing protection when both rails are close
Confirmed buy/sell labels: Compact BUY and SELL labels mark fresh impulse continuation or rail retest continuation on confirmed bars
Heat candles: Optional candle coloring by impulse and memory strength
Dashboard: Top-right panel shows impulse, memory, state, and rail status
Alerts: Fresh impulse, rail retest, confirmed buy, and confirmed sell conditions
Input Parameters
Source: Price source used for calculations
Trend Length: Slow EMA basis length
Fast Track Length: Faster EMA used inside the cloud
MAD Length: Median distance length
ATR Length: ATR distance length
Band Multiplier: Scales adaptive bands
Impulse Threshold: Minimum normalized displacement for a fresh impulse
Memory Half Window: Controls decay speed
Rail Visibility: Bars a rail remains eligible for retests
Heat Candles: Enables candle coloring
Dashboard: Shows or hides the top-right dashboard
Rail Labels: Shows active bull and bear rail labels
Buy/Sell Signals: Shows confirmed continuation signal labels
Palette: Selects the local JOAT color preset
Dashboard: Shows the panel
Palette: Selects color pair
How to Use This Indicator
Step 1: Read the Memory State
The dashboard state shows whether the script is tracking bull memory, bear memory, or resetting.
Step 2: Watch Fresh Impulse Events
Fresh impulse alerts show that displacement exceeded the configured threshold in the direction of the trend basis.
Step 3: Use Retest Rails
Rails act as reference levels after impulse. A retest is most meaningful when the dashboard memory state still agrees with the rail direction.
Indicator Limitations
Impulse detection is sensitive to the selected source and threshold
Very low volatility can make normalized movement appear larger
A rail retest is contextual and does not define risk by itself
The memory model fades old impulses; it does not predict the next impulse
Originality Statement
Impulse Memory Engine is original in its use of robust distance normalization, exponential impulse decay, adaptive bands, and retest rails in one compact overlay. It is built with original Pine v6 logic and public mathematical functions.
Disclaimer
This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Impulse readings can fail during choppy markets or sudden volatility shifts. Always use independent analysis and proper risk management.
-Made with passion by jackofalltrades
Indicator

VWAP Gravity Bands [JOAT]VWAP Gravity Bands is an open-source Pine Script v6 overlay that builds an anchored VWAP field with a smoothed T3 basis and ATR ladder bands. It is designed to show how far price has traveled from a session, weekly, or monthly value anchor, then classify that distance as center pull, ladder drift, expansion, or outer-band reaction.
The script is useful when a trader wants the chart to show both location and behavior around VWAP. Instead of a single VWAP line, it creates a full distance map around the anchor, colors candles by their distance from the basis, and highlights confirmed outer reactions without using arrow-style signal clutter.
Core Concepts
1. Anchored VWAP Selection
The anchor can reset on the session, week, or month. The script uses timeframe.change() to produce the reset pulse and ta.vwap() to calculate the anchored value.
anchorTimeframe = anchorChoice == "Week" ? "1W" : anchorChoice == "Month" ? "1M" : "1D"
anchorPulse = timeframe.change(anchorTimeframe)
rawVwap = ta.vwap(sourceInput, anchorPulse)
2. T3 Basis Smoothing
Raw anchored VWAP can move sharply at the beginning of an anchor period. VWAP Gravity Bands runs that value through a T3-style smoother to create a cleaner basis while preserving responsiveness.
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
e3 = ta.ema(e2, length)
basis = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
3. ATR Ladder Bands
The band ladder is based on ATR, not fixed percentages. This lets the distance field expand and contract with the market's current movement range.
ladderUnit = atr * bandStep
upperOne = basis + ladderUnit
lowerOne = basis - ladderUnit
upperThree = basis + ladderUnit * 3.0
lowerThree = basis - ladderUnit * 3.0
4. Distance State Model
Distance from VWAP is normalized by the ladder unit. The script classifies large directional continuation as expansion and failed outer-band tests as reactions.
5. Gradient Candle Coloring
Candles can be colored by their normalized distance from VWAP. This helps identify when price is balanced around the anchor, drifting away from it, or stretched toward an outer band.
Features
Session, weekly, or monthly anchor: Select the VWAP reset period from inputs
T3-smoothed VWAP basis: Cleaner centerline for visual trend and location analysis
ATR ladder bands: Three upper and lower bands scale with current volatility
Expansion state detection: Highlights directional movement away from the basis
Outer reaction detection: Marks confirmed failed tests near the outer ladder
Distance candle mode: Optional gradient candles based on normalized VWAP distance
Dashboard: Shows anchor, state, distance, ATR step, and basis slope
Alert conditions: Upper reaction, lower reaction, upper expansion, and lower expansion
Input Parameters
Visual System:
Palette Preset: Selects color pair
Distance Candles: Enables candle coloring by VWAP distance
Dashboard: Shows top-right state panel
Raw VWAP: Displays the unsmoothed anchored VWAP
Outer Reaction Marks: Shows compact TP-style outer reaction markers
VWAP Gravity:
Anchor: Session, Week, or Month
Source: Price source used for VWAP
T3 Basis Length: Smoothing length for the VWAP basis
T3 Factor: Controls T3 smoothness
ATR Length: Volatility length used for ladder distance
ATR Step: Distance between ladder bands
Expansion Step: Threshold for expansion classification
Reaction Step: Threshold for outer reaction classification
How to Use This Indicator
Step 1: Choose the Anchor
Use Session for intraday context, Week for swing context, and Month for broader value location.
Step 2: Read Distance From Basis
The dashboard distance value shows how many ladder units price is away from the smoothed VWAP basis.
Step 3: Separate Expansion From Reaction
Expansion means price is moving away from VWAP with slope confirmation. Reaction means price tested an outer area and closed back inside.
Step 4: Use the Bands as Context
The bands are not automatic entry levels. They show location. Combine them with market structure, candle behavior, and risk planning.
Indicator Limitations
VWAP is volume-based and may behave differently on symbols with sparse volume
The first bars after a new anchor can be less stable because VWAP is starting a new sample
Reaction markers show a confirmed close back inside a zone, not a future reversal forecast
ATR bands adapt to volatility but can widen quickly after large bars
Originality Statement
VWAP Gravity Bands is original in how it combines anchored VWAP selection, T3 smoothing, ATR ladder geometry, distance-colored candles, and separate expansion/reaction states. It is built from public Pine v6 functions and original logic rather than copied indicator source.
Disclaimer
This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. VWAP location and band reactions can fail in trending, news-driven, or low-liquidity markets. Always use independent analysis and proper risk management.
-Made with passion by jackofalltrades
Indicator

Strategy

Calibrated Supertrend Strength-Graded & Multi-Timeframe## Calibrated Supertrend — Confirmed, Strength-Graded & Multi-Timeframe (ST ARC)
### What it is
A Supertrend rebuilt to fix the three things that frustrate everyone who uses the
plain version, and to tell you **how trustworthy each trend flip is** before you act
on it. A classic Supertrend uses a **fixed ATR multiplier** (an arbitrary guess that
whipsaws in volatile markets and lags in calm ones), it **flips on noise** (every
marginal poke through the band reverses it), and it gives you **no sense of quality**
(a great flip and a junk flip look identical). ST ARC addresses all three, then
scores every flip 0–100 and — crucially — **calibrates that score to what actually
happened on this symbol**, so the number is accountable rather than decorative.
It runs on **any symbol, asset class, timeframe and market**. The raw data source
and every optional feed are user-selectable; nothing is hard-coded to a market.
### Why these components are combined (mashup rationale)
Each layer removes one specific, nameable failure of the plain Supertrend and feeds
the next — none is decorative:
1. **Adaptive multiplier** — the band width is no longer fixed. The ATR multiplier
becomes a series that scales with a **volatility rank** (how high current ATR
sits versus its own recent history): wider when volatility is high to cut
whipsaw, tighter when calm, and wider still when trend **efficiency** is low
(choppy tape). The ATR *length* can also adapt to the measured dominant cycle.
2. **Confirmation gate (de-whipsaw)** — a raw flip is only **confirmed** when the
close breaches the prior band by a minimum fraction of ATR *and* a minimum number
of bars have passed since the last flip, evaluated on closed bars
(non-repainting). This fixes the "flips on noise" problem.
3. **Regime classifier** — efficiency ratio + trend strength + a volatility-cluster
measure label the market Trend / Range / Volatile, so flips are trusted or
discounted by context.
4. **Multi-timeframe agreement** — three higher-timeframe Supertrends (multiples of
your chart timeframe) are read with no repainting and counted for agreement; a
signal that all higher timeframes oppose can be vetoed.
5. **Flip-strength score + conviction with hard vetoes** — at each flip a 0–100
strength is built from breach depth, trend strength, efficiency, MTF agreement,
regime alignment, volume thrust and volume delta, then gated by hard vetoes
(volatility spike, higher timeframes opposed, a fresh flip inside a chop regime,
cross-asset conflict). The output is one verdict plus a strength grade.
Remove any single layer and a specific Supertrend failure returns — that is the
justification for combining them.
### How it is original
ST ARC keeps a **self-calibrating quality engine**. It records every confirmed flip
and, a fixed window later, checks whether price actually ran a **favourable target
(measured in ATR)** in the flip's direction — i.e. whether the trade *worked*, not
merely whether the line avoided re-flipping. From that it reports, on the dashboard
and on each flip label, the **realized win-rate of past flips at each strength tier**
on this very symbol, plus the average favourable excursion. It can even **auto-learn
the strength threshold** at which flips have historically met a target win-rate and
use that as the action filter. A stock Supertrend tells you nothing about the quality
of its own signals; this one is accountable to its own track record.
### What it plots
- A single **Supertrend line** on price, green up / red down, with the flip triangle
**colour-graded by strength** (strong = solid, weak = faded) and a small
**strength label** on each flip (score + grade).
- An optional **second, slower Supertrend** (thinner line, contrasting colour,
diamond markers) for fast/slow confluence, with a DUAL agreement readout.
- A compact **dashboard**: verdict, regime, direction, the live adaptive multiplier
and ATR length, the flip state with its strength and that tier's realized
win-rate, MTF agreement, the calibration stat, dominant cycle, a risk-based size
reference and any active veto.
### How to use it
1. Trade with the line: long bias while it is below price (green), short while above
(red). The line is a natural trailing stop.
2. Act on **confirmed flips** (the triangles), not raw touches, and weight them by
the **strength score** — strong flips in a Trend regime with higher-timeframe
agreement are the high-quality ones; weak flips in a chop regime are the ones to
skip.
3. Use the **conviction / strength gates** and any active **veto** as a filter; the
optional **auto-learned strength cutoff** suppresses the verdict on flips weaker
than the level that has historically met your target win-rate.
4. The size shown is an ATR-based reference for journaling, not an order.
5. Alerts cover confirmed flips, the conviction verdict, raw flips and the secondary
Supertrend.
### Settings (use on any asset / market)
- **Raw data source** — `hl2`, `hlc3`, `close`, `ohlc4`, or point it at **another
indicator's plot**. This is what lets it work on any instrument or on your own
series.
- **Supertrend core** — ATR length (with optional dominant-cycle adaptive length)
and base multiplier.
- **Adaptive multiplier** — volatility-rank lookback, calm/volatile scaling and an
optional chop-widening term.
- **Confirmation** — minimum breach in ATR, minimum bars between flips, non-repaint
on close.
- **Calibration** — the judging window and the favourable target (in ATR) that
defines a "good" flip; the auto-learn cutoff and its target win-rate.
- **Regime / MTF / conviction weights / secondary Supertrend** — all exposed.
- **Optional feeds (blank = off):** a *volatility-index symbol* (spike veto) and a
*cross-asset symbol* (confluence). Both blank by default, so the script is fully
self-contained on any market.
### Notes
- It is a **study / indicator**, not a strategy, and it places no orders.
- Confirmed flips are evaluated on bar close to avoid intrabar repainting;
higher-timeframe reads use confirmed values.
---
### Disclaimer
This script is provided for educational and informational purposes only. It is a
technical-analysis study, not financial, investment, or trading advice, and not a
recommendation or solicitation to buy or sell any instrument. No indicator can
predict markets; past behaviour and any historical statistics shown (including the
flip win-rates) do not guarantee future results. Trading involves substantial risk of
loss. You are solely responsible for your own decisions — do your own research and
consider consulting a licensed financial professional before trading. The author
accepts no liability for any loss arising from use of this script.
Indicator

UT Bot v2 - ATR Trailing StopIf you're familiar with the original UT Bot: the core logic is the same. This version focuses on cleaner visuals, improved code quality, better customization, built-in alerts, and integrated strategy support, while preserving the underlying ATR trailing stop methodology.
UT Bot v2 is a modernized implementation of the original UT Bot, built around the same ATR-based trailing stop logic that made the original popular.
The indicator uses an adaptive trailing stop based on the Average True Range (ATR). When price crosses the stop level, the trend state flips and a new trailing stop begins to form in the opposite direction.
Rather than changing the algorithm, this release focuses on making it clearer, easier to configure, and more practical for everyday use.
Features
Classic ATR trailing stop logic
Clean and intuitive trend visualization
Buy and sell signal markers
Configurable ATR period and multiplier
Customizable price source
Built-in PulseWire alerts
Integrated strategy for backtesting
Lightweight and easy to understand
Methodology
UT Bot v2 is not a predictive indicator. It does not attempt to forecast future price movements or identify exact market tops and bottoms.
Instead, it is a trend-following and risk management tool that dynamically adjusts its trailing stop using market volatility measured by ATR.
Like most trend-following systems, it tends to perform best during sustained directional moves and may generate whipsaws during ranging or low-volatility conditions.
Philosophy
The goal of UT Bot has always been to provide a simple, transparent, and systematic trailing stop framework, rather than a "holy grail" trading system.
This version preserves that philosophy while improving readability, customization, visualization, and integration with PulseWire alerts and strategy testing. Strategy

Momentum Leader ATR Risk MapMomentum Leader ATR Risk Map is a position-management indicator designed to help traders visualize where a leading stock is trading relative to its 50-period SMA and ATR-based extension levels.
The goal is not to generate automatic buy or sell signals. Instead, this tool provides a structured risk map for momentum leaders by combining:
• ATR extension from a configurable SMA baseline
• Positive extension bands for profit-taking and risk management
• Negative extension bands for pullback, add-zone, and damage-control reference levels
• Relative strength scoring versus a benchmark such as SPY
• SMA trend status
• Optional liquidity, sector RS, and industry RS filters
• Nearest upside and downside map levels shown directly in the table
By default, the indicator uses a Daily anchor and 50-period SMA baseline, making it suitable for swing trading and longer-term position management in momentum leaders. A 24-hour / 1440-minute anchor is also available for users who prefer to evaluate instruments with extended-hours or near-24-hour trading behavior.
Core Risk Map Levels:
Positive Extension Zones:
• +2.95x ATR: High-RS leader zone
• +4.56x ATR: Super momentum zone
• +5.27x ATR: Approximate 2σ risk zone
• +7.83x ATR: Approximate 3σ profit zone
• +10.00x ATR: Extreme / trail-only zone
Negative Extension Zones:
• -1.00x ATR: Pullback
• -2.00x ATR: Add zone
• -3.00x ATR: Deep pullback
• -4.56x ATR: Damage control
• -5.27x ATR: Washout / reclaim-needed zone
The table is designed to answer a few practical questions quickly:
• Is the stock still acting like a leader?
• Is price extended, normal, or damaged relative to the SMA/ATR map?
• Is the SMA trend still constructive?
• Is relative strength still intact across multiple lookback windows?
• Where is the nearest upside ATR map level?
• Where is the nearest downside ATR map level?
Relative Strength Logic:
The RS Score compares the current symbol against a user-selected benchmark over 21, 63, 126, and 252 anchor bars. A score of 4 of 4 means the symbol is outperforming the benchmark across all four lookback windows.
Optional Advanced Inputs:
The indicator includes optional sector and industry RS inputs for users who want to manually compare the stock against relevant ETFs such as XLK, SMH, IGV, XBI, XLE, XLF, or other sector/industry proxies. These are turned off by default to keep the tool frictionless.
A liquidity filter is also available, but it is turned off by default so the indicator can remain focused on the risk map itself.
Credit and Inspiration:
This indicator was inspired by concepts shared by several market educators and traders:
• Jeff Sun / @jfsrev
x.com
• @i_manage_risk
x.com
• StratLab / @StratLaboratory
x.com
Their publicly shared work on relative strength, momentum leadership, ATR extension frameworks, risk management, and scaling into or out of leaders helped shape the conceptual foundation for this tool.
This script is an independent implementation. It is not affiliated with, sponsored by, or endorsed by Jeff Sun, @i_manage_risk, StratLab, or @StratLaboratory, and it is not intended to replicate their complete methodologies.
Suggested Use:
This indicator is best used as a position-management overlay for stocks that have already been identified as potential leaders through a separate screening process. It can help define areas where the stock may be:
• Acting normally within a leadership trend
• Becoming extended into profit-taking zones
• Pulling back toward constructive support
• Losing momentum or entering damage-control territory
Important Notes:
ATR extension levels are reference zones, not guaranteed targets or support/resistance levels. A stock can remain extended for longer than expected, especially during strong momentum regimes. Conversely, deep pullbacks can signal deterioration rather than opportunity if leadership and trend structure are no longer intact.
Use this tool alongside broader market context, earnings risk, volume behavior, trend structure, and personal risk-management rules.
This indicator is for educational and informational purposes only and does not constitute financial advice. Indicator

Tectonic Regime Protocol [JOAT]Tectonic Regime Protocol
Introduction
Tectonic Regime Protocol is an open-source Pine Script v6 strategy that combines four analytical modules into a single rule-based trading system: a four-state regime classifier, a three-layer trend filter, a six-pillar confluence entry engine, and an adaptive exit module using ATR-based partial take-profit and a regime-adaptive trailing stop.
The strategy is designed for traders who want a fully automated systematic framework to study how regime-gating affects signal quality. Its primary hypothesis is that directional entries made when (1) the market is classified as a trending regime, (2) trend filters across multiple timeframes align, and (3) multiple structural, volume, and momentum inputs agree, produce statistically better outcomes than entries based on any single condition alone.
Strategy Default Properties
Initial capital: $100,000
Order size: 2% of equity per trade
Commission: 0.04% per side
Slippage: 2 ticks
Maximum open positions: 1
These settings represent realistic conditions for a funded discretionary trader using a liquid futures or equity instrument. The 2% equity sizing limits maximum theoretical drawdown from any single trade while providing meaningful position exposure. Commission and slippage values reflect typical institutional-grade execution costs for electronically traded instruments.
Core Concepts
1. Four-State Regime Classifier
The regime module classifies each bar into one of four states using ADX relative to a threshold and the ATR-to-SMA(ATR) ratio: Trend Bull, Trend Bear, Range High-Vol, Range Low-Vol. Only Trend states are eligible for entry. Range classifications suppress all entries regardless of how strong the confluence score is. This is the primary market context filter.
2. Three-Layer Trend Filter
Three independently computed trend conditions must all agree before a long or short entry is considered: close versus VWMA(200) determines whether price is above or below long-term value; the relationship between fast and slow HMA lines determines medium-term momentum direction; and the close versus a 50-period EMA on a higher timeframe provides multi-timeframe context.
3. Six-Pillar Confluence Score
The entry engine scores six market dimensions and requires the composite bull or bear score to exceed 50 of 100 (default, configurable) with a directional lead of at least 8 points above the opposing score. The six pillars are: market structure, OBV slope direction, KAMA position + RSI + WPR composite, swing-low liquidity sweep detection, ATR ratio in productive range, and Fractal Efficiency Ratio above 0.30.
bool longSetup = validRegime and regime == 1 and trendBull
and bull >= confThreshold and (bull - bear) >= confGap
and barstate.isconfirmed
4. Adaptive Exit Module
The exit logic uses partial exits at two take-profit levels. TP1 closes 50% of the position at 1.0× risk distance. TP2 closes the remaining position at 2.0× risk distance. After TP1 is reached, the stop is moved to the entry price (breakeven). The stop before TP1 uses a regime-adaptive ATR trail — the stop multiplier is lower in low-volatility regimes (tighter) and higher in high-volatility regimes (looser). A 30-bar time-based exit closes any remaining position if neither TP nor stop is reached.
5. Non-Repainting Architecture
All entry conditions are evaluated only when barstate.isconfirmed is true. The HTF EMA is requested with lookahead=barmerge.lookahead_off. Pivot-based conditions use confirmed pivot detection with symmetric lookback. No future bar references are used.
Default Settings and Performance Notes
The strategy is published with the default Properties values listed above. Results shown on the publication chart are generated using these exact settings. Commission of 0.04% per side is representative of typical electronic execution on liquid instruments.
Win rate alone does not characterize strategy performance. The strategy is designed around a two-tier partial exit structure targeting positive expectancy (wins × average win greater than losses × average loss) rather than high win rate. The profit factor and average R-multiple are the more relevant metrics for this type of system.
Input Parameters
Regime Module:
ADX Trend Threshold (default: 20)
ATR Ratio High-Vol Threshold (default: 1.2)
Trend Filter:
VWMA Length (default: 200)
Ribbon Fast HMA and Slow HMA lengths
HTF Timeframe for EMA(50) filter (default: 240)
Enable HTF Filter toggle
Confluence Engine:
Min Score (default: 50, range 50–95)
Min Direction Lead (default: 8)
Min FER (default: 0.30)
FER Lookback (default: 14)
Individual pillar weights (Structure, Volume, Momentum, Liquidity, Volatility, FER)
Exit Module:
TP1 RR Multiple (default: 1.0)
TP2 RR Multiple (default: 2.0)
Stop Multiplier for Low / Med / High Volatility Regimes
Max Bars Hold (default: 30)
How to Evaluate This Strategy
Apply it to a liquid instrument with sufficient historical data to generate more than 100 trades. Compare profit factor, Sharpe ratio, average R-multiple, and maximum drawdown — not win rate in isolation. Test it across at least two different instruments or timeframes to assess whether the results reflect genuine structural edge or data-fitting to one specific market.
The strategy is not optimized for any single market. Default parameters are deliberately conservative to avoid overfitting. Users who adjust parameters to improve backtested results should recognize that improvement on historical data does not guarantee improvement on future data.
Strategy Limitations
On lower-timeframe charts with short histories, fewer than 100 trades may result, reducing the statistical reliability of the backtest
The HTF filter uses request.security() with a higher timeframe EMA. In live trading, the HTF value updates when the higher timeframe bar closes, which may differ slightly from live server-side execution
ATR-based stops and targets mean position sizes and outcomes scale with volatility. In abnormally low-volatility environments, commission costs represent a larger proportion of expected gain
The time-based exit at 30 bars may close profitable positions before TP2 is reached in slow-moving markets
Backtested performance on any instrument does not predict future performance. Markets change, and parameters that produced edge historically may not do so in future regimes
Originality Statement
Combining a four-state regime classifier, a three-layer multi-timeframe trend filter, a six-pillar confluence score including Fractal Efficiency Ratio, and a partial-exit adaptive trailing stop system in a single non-repainting open-source strategy is an original integration of methods
The Fractal Efficiency Ratio as a pillar in a multi-factor entry score, and as a required gate condition for entry, is not present in existing open-source Pine Script v6 strategy publications as of this writing
The regime-adaptive stop multiplier — loosening in high-volatility regimes and tightening in low-volatility regimes — is an original stop calibration approach within this strategic framework
The dual entry mode (edge transition OR re-entry when flat with elevated score) increases signal frequency without compromising the fundamental regime and trend filter requirements
Disclaimer
This strategy is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Backtested results are simulated and do not represent real trading. Simulated results have inherent limitations and may not reflect actual trading outcomes due to market impact, execution differences, and changing market conditions. Past backtested performance does not guarantee future results. Trading involves substantial risk of loss. Always conduct independent due diligence and apply proper risk management before using any strategy with real capital. The author accepts no responsibility for trading losses resulting from use of this strategy.
Made with passion by jackofalltrades
Strategy

Session King - ALMA with Session FilterA session-gated trend strategy that restricts entries to high-liquidity
session windows using ALMA direction bias, with standardised ATR exits
(3 ATR stop, 6 ATR take profit — 2R fixed).
WHAT MAKES THIS ORIGINAL
Most trend strategies fire entries continuously throughout the trading day.
This strategy gates every entry through two independent filters before a
signal is accepted: a directional bias filter (ALMA) and a session timing
filter. Neither filter alone is the edge — the combination is. ALMA without
the session gate fires too many signals in low-liquidity periods. The session
gate without a directional filter trades noise in both directions. Together
they restrict entries to directional moves inside high-liquidity windows
where volume and participation are highest.
COMPONENTS
ALMA (Arnaud Legoux Moving Average, length 9): Direction baseline. Price
above ALMA = long bias; price below = short bias. ALMA applies Gaussian
weighting to reduce lag compared to EMAs of equivalent length, producing
fewer whipsaws at signal transitions.
Session Filter (toggleable): Entries are only permitted during defined
high-liquidity windows. London open (05:45-09:45 GMT), NY AM (12:00-16:00
GMT), and NY PM (19:00-21:00 GMT) can each be toggled independently.
Outside these windows the strategy does nothing. Most false signals in
forex and gold occur during low-volume inter-session periods.
TTM Squeeze (optional, off by default): Based on John Carter's published
TTM Squeeze concept. Compression detection (BB inside KC) is an independent
implementation using Pine built-ins only; Keltner Channel uses ATR via
Wilder's method. No momentum histogram is included — only the compression
gate is used. When Bollinger Bands contract inside the Keltner Channel the
market is in compression and entries are blocked. When BB expands back
outside the KC entries are permitted again. Enables lower-frequency,
post-compression entries when toggled on.
Exits: Fixed 3 ATR stop-loss and 6 ATR take-profit (2R) on every trade.
Position size is calculated so that 1% of equity is risked per trade at
the 3 ATR stop distance.
WHY THIS COMBINATION
ALMA provides direction bias with reduced lag. The session gate ensures
entries only occur when volume and institutional participation are highest.
Fixed ATR exits keep risk consistent across instruments and timeframes and
allow meaningful comparison of strategy performance across different market
conditions.
HOW TO USE
Enable the sessions that match your instrument. London + NY AM is the
default for forex and gold. Enable TTM Squeeze for lower-frequency,
higher-conviction setups. Best suited to 4H and 1H timeframes on XAUUSD,
GBPUSD, EURUSD, and major indices.
DEFAULT PROPERTIES
ATR Length: 14 | Stop: 3x ATR | Take Profit: 6x ATR (2R) | Risk: 1%
Commission: 0.01% per side | Slippage: 1 tick | Initial capital: 10,000
LIMITATIONS
Session filtering significantly reduces trade count. On 4H timeframes
expect 15-40 trades per year. To reach 100+ trades for a statistically
meaningful sample, backtest a minimum of 3-5 years on 1H or 8-10 years
on 4H. Past results do not guarantee future performance.
Strategy

Adaptive Equilibrium Deviation OscillatorAdaptive Equilibrium Deviation Oscillator (AEDO)
What it is
AEDO is a mean-reversion oscillator. It plots one core reading — the standardized distance between price and its own adaptive equilibrium — and then surrounds that reading with context filters whose only job is to stop the two ways mean-reversion entries usually fail. It is symbol- and timeframe-agnostic: the price source and the optional reference symbols are all selectable in Settings, so it can be applied to any market.
What it plots
The oscillator line: how far price sits from its adaptive equilibrium (an EMA or linear-regression fair value), expressed in standardized units. Zero = at equilibrium; positive = stretched above; negative = stretched below.
Adaptive bands: the threshold beyond which the stretch is treated as "extreme." The bands widen and narrow with volatility, so an extreme reading means the same thing in quiet and busy conditions.
Signal markers: a triangle when the oscillator turns back across a band (a reversion attempt); a small circle for the same event in a less favorable regime.
Divergence lines/labels between the oscillator and price.
A dashboard showing the script name, symbol and timeframe, plus the live equilibrium, volatility state, regime, higher-timeframe bias, confluence grade and a reference fade stop/target.
Why these components are combined (mashup justification)
This is not a collection of independent indicators stacked together. Every part is subordinate to one idea — measure the deviation from equilibrium, and only act on it when the surrounding context supports reversion. Mean-reversion fails in exactly two situations, and each component addresses one of them:
Fading a genuine trend. A stretched oscillator in a strong directional move is a trap, not an opportunity. The ADX regime gate and the higher-timeframe trend filter prevent counter-trend fades, so the oscillator's extremes are only acted on when the market is actually ranging and the bias agrees.
Mistaking a normal pullback for an extreme. A fixed band misreads volatility. The volatility-adaptive bands rescale the "extreme" threshold using either this instrument's own ATR relative to its average, or an optional external volatility index — so the deviation reading keeps a consistent statistical meaning as conditions change. The robust (median/MAD) standardization does the same on the deviation series itself, resisting fat-tailed spikes.
The remaining parts refine confidence in that single reading rather than generating separate signals:
Divergence between price and the oscillator, and a 0–N confluence grade, require independent agreement before a signal is graded as strong.
An optional secondary-symbol spread check (e.g. a future vs. its underlying, or two correlated assets) adds a structural sanity filter; it is off by default and contributes nothing on single-asset charts.
Confirmation filters (confirm-on-close, clearance beyond the band, optional session-open skip) make signals non-repainting and reduce noise.
The calibration tracker logs each signal on past bars and, after a fixed horizon, records whether price actually followed through by a chosen ATR amount — reporting a historical hit-rate with a Wilson 95% confidence interval, binned by confluence grade.
Together they form one decision: price is far from equilibrium → is the context one where reversion is plausible → how much independent agreement is there → how has this exact condition resolved historically. Remove any one piece and the remaining system is measurably more exposed to one of the two failure modes above.
What is original here
The oscillator is built around an adaptive equilibrium with statistically standardized deviation and volatility-scaled bands, rather than a fixed-scale momentum formula.
The confluence grade uses a dynamic denominator, so enabling/disabling the optional spread filter doesn't artificially inflate the grade.
The built-in calibration tracker with Wilson confidence intervals is descriptive transparency: it lets you check, per confluence tier, how the flagged condition resolved on past data before trusting it — a measurement layer most oscillators don't include.
How to use it
Add it to any chart and timeframe. Leave the price source at close to start.
Reversion entries: look for the oscillator turning back across a band (a marker prints). Treat triangles (favorable regime) as higher-quality than circles.
Confluence: the dashboard shows the long/short grade; raise Min confluence to allow signal to filter to only higher-agreement setups.
Volatility: keep "Instrument (self)" for any standalone asset, or switch to "External symbol" and enter a volatility index for your market.
Secondary spread (optional): enable it and enter a related symbol only if a cross-symbol structure check is meaningful for your instrument.
Validate before trusting it: open the Calibration Tracker group, enable Show calibration panel, set Min confluence to 0, and let it accumulate signals. Read the per-tier hit-rates and confidence intervals on your own symbol/timeframe before relying on any signal. A wide or near-50% interval means the condition has no measured reliability on that market.
Settings overview
Price source · equilibrium type & length · standardization mode & window · band levels · volatility source (self/external) & band multipliers · optional secondary-symbol spread · ADX regime & higher-TF trend gate · confirmation filters · confluence & multi-timeframe agreement · divergence · calibration horizon & follow-through · visuals.
Notes / limitations
Mean-reversion logic suits ranging conditions; the gates reduce but do not eliminate trend risk.
Signals confirm on bar close and do not repaint; external-symbol requests use no look-ahead.
After load, the oscillator needs its standardization window (default 200 bars) to warm up; the dashboard "Data" row shows readiness.
Disclaimer
This script is provided for educational and informational purposes only. It is not financial, investment, or trading advice, and it is not a recommendation to buy or sell any instrument. The calibration figures are descriptive statistics of past bars and do not predict future results. Trading involves substantial risk of loss. Test thoroughly and use your own judgment; you are solely responsible for your decisions. Indicator

Session ATR Risk ToolSession ATR Risk Tool
## Overview
The Session ATR Risk Tool is a discretionary **risk-management and trade-planning overlay**. It sizes a stop loss from market volatility, projects fixed reward-to-risk targets (1:1, 1:2, 1:3), and draws a standard-deviation ladder so you can see your full trade geometry on the chart before you enter. It also estimates a contract count from a fixed dollar risk, and prints a context table of intraday, daily and weekly volatility.
It is built and tuned for Micro E-mini Nasdaq-100 (MNQ) intraday trading, but every parameter is exposed as an input, so it works on any symbol once you set the correct point value.
This tool does **not** generate buy/sell signals and makes no claim about win rate or profitability. It is a visualization and planning aid only.
## What makes it different
Most reward-to-risk tools place lines a fixed number of ticks or a single ATR away. This tool adds three things in one package:
1. **Two selectable stop engines.** The stop distance can be derived from either the chart-timeframe ATR (small, realistic intraday stops) or from a rolling average of completed *session* ranges (swing-sized stops). You choose which volatility regime sizes your risk.
2. **A standard-deviation ladder denominated in your own stop distance.** Instead of arbitrary fib or price-percent levels, each rung is a multiple (−0.5, 1, 2, 3, 4 by default, all editable) of the exact ATR-based stop distance, projected from entry. One "sd" on the chart always equals one unit of the risk you are actually taking.
3. **A volatility context table.** Intraday ATR, averaged session range, daily ATR(14) and weekly ATR(14) are shown side by side so the chosen stop can be judged against higher-timeframe volatility at a glance.
## How it works
- **Session range capture.** The script tracks the high and low of each completed session window (default 09:30–16:00 exchange time) and stores the high-low range. It keeps a rolling buffer of the most recent N sessions (default 10) and averages them to produce a "session ATR" in points.
- **Intraday ATR.** A standard ATR of configurable length is calculated on the chart timeframe for scalp-sized stops.
- **Stop distance.** `Stop distance = chosen basis × ATR multiplier`, where the basis is either the intraday ATR or the averaged session range. The multiplier lets you tighten or widen the stop.
- **Trade geometry.** From the entry price (live price by default, or a fixed price you type in) and the trade direction, the tool places the stop one stop-distance against you, then projects targets at 1×, 2× and 3× the stop distance for clean 1:1 / 1:2 / 1:3 reward-to-risk.
- **Standard-deviation ladder.** Each ladder rung is plotted at `entry + direction × stop distance × deviation`, giving an evenly scaled map of where price sits relative to your risk unit.
- **Position-size estimate.** Dollar risk per contract = stop distance × point value. Estimated contracts = floor(risk per trade ÷ dollar risk per contract). This is an arithmetic estimate for planning, not an order-routing instruction.
- **Higher-timeframe context.** Daily and weekly ATR(14) are pulled from confirmed higher-timeframe bars (non-repainting) for the context table.
All levels are drawn as faded horizontal rays anchored to the bar grid, so they stay locked to the candles when you pan or zoom. Drawings rebuild on the most recent bar to keep the chart clean.
## How to use it
1. Add the tool to an intraday chart of the instrument you trade.
2. Set **$ per Point** for your instrument (MNQ = 2.0, NQ = 20.0, MES = 5.0, etc.) and your **Risk per Trade ($)**.
3. Choose your **Stop Basis** — "Intraday ATR" for scalps and intraday entries, "Session Range" for wider, swing-style stops.
4. Adjust the **ATR Multiplier** to set how far the stop sits from entry. As a starting guide, roughly 1.0–2.0× with Intraday ATR on a 1–5 minute chart; if using Session Range, scale the multiplier down (around 0.10–0.20×) because the session range is much larger.
5. Set **Trade Direction** (Long or Short). Leave **Entry Price** at 0 to anchor the levels to live price, or type your actual fill price to lock the geometry in place after entry.
6. Read your plan off the chart: the Stop, the 1:1 / 1:2 / 1:3 targets, the standard-deviation ladder, and the info table showing the stop in points and dollars plus an estimated contract count.
## Inputs
- **Session Window / Sessions to Average** — defines the session and how many completed sessions feed the averaged session range.
- **Stop Basis / Intraday ATR Length / ATR Multiplier** — select and tune the volatility source for the stop.
- **Trade Direction / Entry Price** — direction toggle and optional fixed entry.
- **$ per Point / Risk per Trade ($)** — instrument tick value and account risk used for the size estimate.
- **SDev Ladder deviations** — the five editable ladder multiples.
- **Visual controls** — ray length back/forward, table toggle, and colors for up, down and entry levels.
## Notes and limitations
- The contract-count figure is an arithmetic estimate from your inputs. It is not connected to a broker and places no orders. Always confirm size and risk in your own platform.
- "Session ATR" here means the averaged high-low **range** of recent sessions, not a true-range calculation; it is intentionally a wider, regime-level measure.
- Higher-timeframe ATR values use confirmed bars to avoid repainting.
- Reward-to-risk targets are fixed geometric projections; they are not predictions of price reaching those levels.
- This script is a planning and visualization tool only. It is not financial advice and does not guarantee any outcome. Indicator

Volatility Regime Dashboard## Overview
Volatility Regime Dashboard is a context and visualization tool that classifies the
current volatility state of any symbol as **Compressed**, **Normal**, or **Expanded**.
Instead of plotting a single raw volatility line, it combines two independent
normalized measures and only changes the displayed state when both of them agree.
A compact table reports the underlying numbers and how many bars the current regime
has lasted.
This script is a visualization and context tool. It does not generate buy or sell
signals. It does not provide financial advice and makes no performance, accuracy,
or future-result claims.
## What it visualizes
- A line in its own pane showing the **percentile rank of price-normalized ATR**
(0-100), with dashed guides at the compressed and expanded thresholds and a
dotted midline.
- A **regime background shade** (optional) coloring the pane by the current state.
- A **context table** with the regime name, the ATR percentile value, the
Fast/Slow ATR compression ratio, whether the two measures currently agree, the
regime persistence in bars, and the ATR length in use.
## How it works
Two measures are computed independently:
1. **Price-normalized ATR percentile.** ATR is divided by price (so the measure is
comparable across symbols and price levels), then ranked as a percentile over a
user-defined lookback (default 252 bars). A high percentile means current ATR is
large relative to its own recent history; a low percentile means it is small.
2. **Fast/Slow ATR compression ratio.** A fast-window ATR is divided by a
slow-window ATR. A ratio above 1 means range is expanding relative to its
baseline; below 1 means it is compressing.
Each measure is classified into Compressed (-1), Normal (0), or Expanded (+1) using
its own thresholds. The displayed regime uses **hysteresis**: it flips to Expanded
or Compressed only when **both** measures agree on that direction, returns to Normal
only when both measures sit in their middle bands, and otherwise **holds** the prior
regime while the two measures disagree. This reduces flicker compared with reacting
to either measure alone. A persistence counter tracks how many consecutive bars the
current regime has held.
## How to use it
- Read the regime as **situational context** about how active the market currently
is relative to its own recent behavior, not as an instruction to act.
- Watch the percentile line approach the dashed thresholds to anticipate when a
regime change may be confirmed by both measures.
- Use the persistence counter to gauge whether a regime is freshly established or
well established.
- Adjust the lookback and thresholds to match the symbol and timeframe you study;
the defaults suit daily charts and are a starting point, not an optimized set.
## What makes it original
Most volatility tools plot a single raw or smoothed value. This dashboard derives a
**single discrete regime from the agreement of two structurally different measures**
- a within-history percentile rank and a fast-versus-slow ratio - and gates state
changes with hysteresis so the regime persists through brief disagreement. It then
surfaces the **persistence duration** of the current regime. The combination of
cross-measure agreement, hysteresis, and persistence reporting is the contribution;
it is not a re-skin of a built-in ATR, Bollinger, or standard-deviation indicator.
## What it does not do
- Does not generate buy/sell signals.
- Does not give entry/exit, target-level, or position-sizing instructions.
- Does not predict price or forecast performance.
- Does not run a strategy or backtest.
- Does not place or manage orders for you.
## Limitations
- Volatility regime is **descriptive context**, not a forecast; an Expanded or
Compressed state can persist or reverse at any time.
- The percentile rank depends on the lookback window; very small lookbacks make the
state noisy and very large ones make it slow to update.
- On symbols or timeframes with sparse history, the percentile may be unstable until
enough bars are available.
- ATR divided by price assumes price is positive and non-zero; exotic data feeds may
behave unexpectedly.
- Default thresholds are reasonable starting values, not values tuned for any
particular market.
## Suggested chart setup
- Use a liquid, recognizable symbol on a daily timeframe so the percentile lookback
has enough history.
- Keep the chart clean: this indicator opens in its own pane, so remove unrelated
indicators and let the percentile line, threshold guides, regime background, and
table be clearly visible.
- Make sure the indicator name, symbol, and timeframe are visible in any published
screenshot.
---
## Japanese notes / 日本語補足
このスクリプトはボラティリティの状態を「Compressed(収縮)」「Normal(通常)」
「Expanded(拡大)」として表示する、コンテキスト把握用の可視化ツールです。価格で
正規化したATRのパーセンタイル順位と、ファスト/スロー期間のATR比率という2つの独立
した指標を用い、両者が一致したときだけ状態を変更するヒステリシス方式を採用していま
す。表には各指標の数値と、現在の状態が何本のバー継続しているかを表示します。
これは相場の状況を把握するための可視化ツールであり、売買の指示は行いません。投資
助言ではなく、将来の値動きや運用成績に関する主張も一切行いません。新規の建玉や手
仕舞い、ポジションサイズの提案も行いません。しきい値やルックバックは銘柄や時間足に
合わせて調整してください(初期値は最適化されたものではありません)。
Indicator

SAR/ATR Trend-Extension OscillatorSAR/ATR Trend-Extension Oscillator
WHAT THIS INDICATOR IS
The SAR/ATR Trend-Extension Oscillator measures, in a single line, how far price has stretched away from its Parabolic SAR trailing reference, and it expresses that distance in units of volatility rather than raw price. The output is a signed oscillator: it rises into positive (green) territory as an uptrend extends and falls into negative (red) territory as a downtrend extends. The further the value sits from the zero line, the more stretched the current move is relative to its own recent volatility.
It is built as ONE coherent reading. Parabolic SAR and Average True Range (ATR) are not plotted side by side; they are fused mathematically into the oscillator value. Three further elements - a rolling statistical standardization, an ADX regime filter and a higher-timeframe trend filter - qualify and contextualize that value rather than adding separate indicators to the pane.
WHY THESE COMPONENTS ARE COMBINED (and how they work together)
Each ingredient is included to solve a specific weakness of the one before it.
1) Parabolic SAR provides trend direction and a trailing stop level, but on its own it only tells you which side of the trend you are on. The raw gap between price and SAR is measured in price points, which cannot be compared between a low-priced stock and a high-valued index, or between a quiet and a volatile session. So SAR alone cannot answer "how stretched is this move."
2) ATR answers that. By dividing the SAR-to-price gap by ATR, the distance becomes volatility-relative: "price is X average true ranges beyond its SAR." This SAR-divided-by-ATR step is the core of the indicator and produces information that neither Parabolic SAR nor ATR shows alone - a bounded, cross-market measure of trend extension that reads consistently across symbols and timeframes.
3) Rolling standardization (Z-Score, or robust median/MAD) fixes a subtler problem: even an ATR-normalized value has a distribution that drifts over time, so one fixed threshold means different things in different conditions. Standardizing the value over a lookback window rescales it so the +/-2 and +/-3 reference levels keep a stable statistical meaning. A "Raw" mode (the plain volatility-normalized value, no rescaling) is also available.
4) ADX regime filter. Parabolic SAR is prone to repeated false flips in sideways markets. ADX measures trend strength, so the indicator suppresses buy/sell flags whenever ADX is below a user threshold (a ranging market) and shades the background to show it. ADX is never drawn on the oscillator; it only gates the signals.
5) Higher-timeframe filter. The same SAR direction is read from a higher, confirmed timeframe and used to filter out crossings that fight the dominant trend. It is the identical calculation applied to a larger context, not a different indicator.
6) Divergence. Because the oscillator is a measure of trend extension, a price high paired with a lower oscillator high (or a price low paired with a higher oscillator low) indicates the trend is extending less forcefully. Regular and hidden divergences are detected from confirmed pivots and drawn with connecting lines and labels.
Putting it together, the plotted value is one number: sign(SAR trend) x (SAR-to-price gap / ATR), optionally standardized and clamped to limit single-bar spikes.
A buy or sell flag is raised only when that oscillator crosses the Signal level AND the ADX regime AND the higher-timeframe direction agree. Everything feeds one question: is price extending, in a genuine trend, in line with the larger trend?
WHAT MAKES IT ORIGINAL
This is not Parabolic SAR with an ATR drawn next to it. It transforms the SAR trailing stop into a continuous, signed, volatility-normalized and statistically standardized extension oscillator, then wraps that single value in regime and higher-timeframe gating plus divergence logic. The resulting "how stretched is this trend, on a comparable scale" reading does not exist in either source indicator.
HOW TO USE IT
- Choose a normalization mode: Raw, Z-Score, or Robust (median/MAD, least sensitive to spikes).
- Read color and distance: green = uptrend extension, red = downtrend extension; the further from zero, the more extended. The Signal, Warning and Extreme levels mark progressively stretched zones.
- Treat the triangle markers (a Signal-level cross that agrees with the ADX regime and the higher-timeframe bias) as points to investigate, not as automatic entries.
- Use divergences as early warning that extension is fading, and the on-pane dashboard for trend, regime, higher-timeframe bias and ATR-based stop/target context. The stop and target figures are reference levels only.
- All parameters - SAR step and maximum, ATR period and smoothing type, the standardization window, every threshold, the ADX threshold and the higher timeframe - are adjustable.
REPAINTING
Signals confirm on bar close by default and do not repaint. The higher-timeframe filter reads the previous closed higher-timeframe bar, so it does not look ahead. Divergence labels appear a few bars after the pivot they confirm; that lag is inherent to honest pivot detection and is expected behavior.
ATTRIBUTION
This implementation builds on the original concept of combining Parabolic SAR with ATR. The volatility normalization, statistical standardization, regime and higher-timeframe filtering, divergence detection and alerting described above are part of this independent implementation.
DISCLAIMER
This script is provided for research and educational purposes only. It is not financial advice and makes no guarantee of profitability or accuracy. Indicators describe past and present price behavior; they do not predict future prices, and no indicator works in all conditions. Trading involves substantial risk of loss. Always test on historical and out-of-sample data and make your own independent decisions. The author accepts no liability for any use of this script.
Indicator

Structure & Trend ContextStructure & Trend Context is a clean overlay that visualises market structure and trend direction without cluttering the chart. It is built as a context tool to support your own analysis, not as a signal system.
What it shows
- Trend filter: a fast and a slow EMA define the prevailing direction. The slow EMA is colour-coded by bias (up / down / neutral).
- Volatility band: an ATR band around the fast EMA gives a sense of normal price travel and dynamic over-/under-extension.
- Swing structure: the most recent confirmed swing high and swing low are tracked and drawn as reference levels.
- Structure breaks (BoS): a marker appears only when price closes beyond the prior swing by an ATR buffer while in trend. Each level is locked after it breaks, so markers stay rare and meaningful rather than firing on every minor poke.
- Context panel: a compact top-right table showing current trend bias, last higher high and last lower low.
How to use it
Read the chart first. Use the trend filter and band for context, the swing levels for reference, and treat a structure break as one piece of confluence, not a standalone trigger. Raise "Swing sensitivity" on higher timeframes or noisy assets to keep only the larger structure.
Inputs
Every layer (band, swing levels, structure markers, raw pivots, panel, bar tint) has its own toggle, and the EMA, ATR and pivot lengths are fully adjustable.
Notes
This indicator is a visualisation aid for discretionary analysis. It does not predict price, does not generate buy or sell recommendations, and is not financial advice. Markers are confirmed on bar close and do not repaint. Open-source — adapt it to your own workflow. Indicator

SuperTrend Exhaustion Clues [Gabremoku]SuperTrend Exhaustion Clues is a context-aware SuperTrend indicator that separates structural direction from signal timing. Instead of treating every flip as a trade trigger, it classifies market behavior into four states: Transition, Confirmed, Compressed Break, and Exhausted. The goal is to show when trend structure is still healthy, when it is compressing, and when it is weakening enough to start looking for directional clues.
The core logic combines four elements: SuperTrend for directional structure, ADX and DI for trend strength, VWAP and price location for acceptance, and compression detection for squeeze/release context. These components are not merged just for convenience; they work together to decide whether price is merely changing direction structurally or whether it is also showing enough internal confirmation to justify attention.
BUY and SELL signals are not printed on every flip. They are designed to appear only during Exhausted phases, and only when directional clues align with the next likely move. This makes the indicator more selective than a standard SuperTrend and better suited to reading late-stage trend fatigue and early follow-through behavior.
A built-in Signal Profile lets you choose between Responsive, Balanced, and Selective behavior. Responsive lowers the confirmation threshold and is better for faster charts, Balanced is the default middle ground, and Selective raises the bar for cleaner but rarer signals. For this reason, the script is especially useful on lower timeframes, where exhaustion tends to be easier to read and directional clues appear earlier.
For higher timeframes, the script can keep showing state, regime, and clue scores while disabling signals from 4H and above. This helps avoid forcing execution signals where the exhaustion logic is less expressive, while still letting you use the indicator for context and structure.
The visual design is intentionally restrained: bullish states are blue, bearish states are yellow, compression is purple, transition is gray, and exhaustion is red. The SuperTrend line, gradient fill, dashboard, and color legend are meant to make the state of the market easy to read at a glance without cluttering the chart.
How to use it: watch the current state first, then use Exhausted phases as the main area of interest. When the script shows Exhausted and the directional clue score aligns with the next move, that is the moment it is designed to highlight. On 4H and above, the script is better used as a structural context tool rather than a signal engine.
@Gabremoku
PulseWire Indicator

Strategy

Sentinel Cascade [JOAT]Sentinel Cascade
Sentinel Cascade is a three-stage adaptive Supertrend overlay. Where a classic Supertrend uses one fixed-ATR band, this script chains three Supertrend stages on top of each other and modulates each stage's width with a different regime signal. Bands tighten when the market is trending cleanly and widen when volatility expands or behavior turns mean-reverting.
What makes it different
A standard Supertrend gives one binary direction state. Sentinel Cascade gives three nested direction states that act like a confluence stack. Alignment of all three is the highest-conviction read.
The ATR feeding the Supertrend is smoothed through a Kaufman Efficiency Ratio. Trend-efficient periods get a faster ATR response. Choppy periods get a slower response.
Stage 2's width scales with a volume Z-score. High-volume bars widen the band so transient noise is less likely to flip the stage.
Stage 3's width scales with a lightweight two-point Hurst estimator (R/S over short and long windows). Trending Hurst above 0.5 widens. Mean-reverting Hurst below 0.5 tightens.
A Sentinel pulse fires only when Stage 3 flips AND Stage 2 confirms the new direction within three bars. A coincidence filter for higher-quality regime shifts.
How it works
Compute a basis price as the midpoint of the recent highest high and lowest low.
Compute a KAMA-smoothed ATR from the basis.
Build Stage 1 as a Supertrend on the basis using the KAMA-ATR and the Stage 1 factor.
Build Stage 2 as a Supertrend on Stage 1's output, with its factor multiplied by a clamped volume-Z modulator.
Build Stage 3 as a Supertrend on Stage 2's output, with its factor multiplied by a clamped Hurst modulator.
Track the Sentinel pulse, the ATR-percentile regime (squeeze / normal / expansion), and a running count of intraday Stage 3 flips.
Reading the chart
Three stacked trend lines. Stage 1 thickest, Stage 3 thinnest. Colors flip between bull and bear on direction changes.
A gradient ribbon between Stage 1 (or Stage 2 by user choice) and Stage 3 brightens when the stack is spread, fades when it converges.
An optional iridescent candle recolor scales tint with distance from Stage 3.
A horizontal sight-line projects Stage 3's current level back into history so past respect or rejection at that level is visible.
Persistent flip markers record each Stage 3 flip and retroactively append an OK or FAIL tag after a user-defined persistence window.
A right-edge state block summarizes alignment of all three stages plus the ATR squeeze and expansion read.
Signals
Stage 3 bull / bear shift (any flip)
Cascade alignment (all three stages agree)
Stage 2 retest / bounce inside an active trend
ATR squeeze and expansion entry (percentile-based)
All signals are gated on barstate.isconfirmed or barstate.ishistory. No future-bar referencing. No lookahead_on.
Inputs
Cascade : range basis length, ATR period, KAMA efficiency length, Stage 1 / 2 / 3 factors.
Regime : volume-Z lookback, Hurst short / long windows.
Visual : bullish color, bearish color, toggles for ribbon, sentinel pulse, iridescent candles, bounce markers, ribbon anchor.
On-chart : stage value labels, flip timeline labels, squeeze background tint, Stage 3 cloud, sight-line, state block, daily flip counter.
Dashboard : position, size, watermark row.
How traders use this
Trend continuation : take in the direction of Stage 3 when price retests Stage 2 from the trending side.
High-conviction entries : wait for cascade alignment (all three stages agree) before sizing up.
Mean-reversion fades : when Hurst is clearly below 0.5 and a Stage 3 flip prints near recent extremes, the new trend is statistically less likely to persist.
Volatility context : ATR percentile regime tells you whether the move is happening in a compressed, normal, or extended volatility environment. Sizing should account for that.
Limitations
The two-point Hurst estimator is a fast approximation, not the full rescaled-range statistic. It is monotonically meaningful but is not a precise persistence coefficient.
Like every Supertrend variant, this is a trend-following construct. It is best on instruments with clear directional regimes and worst in extended choppy ranges.
Pivots and percentile-based regime classifications need warm-up bars before their values stabilize.
Past behavior is not a guarantee of future behavior. No indicator can remove market uncertainty.
Compatibility
Pine Script v6, single-file open-source indicator. Works on any symbol and any timeframe. Uses no request.security calls. Non-repainting beyond the normal Supertrend right-bar reactivity inherent to band ratchet logic.
Defaults
Mint bullish color, red bearish color, top-right medium dashboard, all on-chart visualizations on. Open the inputs panel to tune for your instrument or to declutter for screenshots.
Indicator

Indicator

50-MA Extension Dot [ATR / % / Points]50-MA Extension Dot marks when price has moved a defined distance above a daily moving-average anchor. The goal of the script is to help traders study when price becomes extended relative to its daily trend structure, rather than judging a move by price alone.
The script supports three extension methods: ATR Extension, Percent, and Points. ATR Extension compares the distance from price to the daily moving average against the instrument’s daily ATR, making the reading volatility-adjusted. Percent mode measures how far price is above the moving average in percentage terms. Points mode measures the raw point distance above the moving-average anchor.
The moving-average type, moving-average length, threshold method, threshold value, ATR length, and extension source are customizable so traders can study past moves and build their own rules. For example, users can test how a symbol historically behaved when it became one ATR, two ATRs, a fixed percentage, or a fixed point distance above its daily moving-average reference.
When the selected threshold is reached, the script plots a small dot above the candle. The dot is not a standalone buy or sell signal. It is a visual marker showing that price has reached a defined extension zone relative to the chosen daily moving-average reference.
The script can also display the daily moving average, an optional threshold line, and a small table showing the current daily moving average, daily ATR, extension price, percentage distance from the moving average, ATR percentage, and ATR extension value.
This tool is useful for studying stretched moves, breakout extensions, momentum exhaustion, and conditions where price may be moving too far too quickly above its daily trend anchor. Because different symbols have different volatility profiles, the customizable inputs allow traders to compare past extensions and develop rules that fit their own process.
This indicator does not predict future price movement. It is a contextual extension tool designed to measure distance from a daily trend reference and help traders research historical extension behavior. Indicator
