Median ATR SD OscillatorMedian ATR SD Oscillator
Median ATR SD Oscillator is a trend-following volatility oscillator that measures the distance between price and two independent reference levels — an ATR band and a standard deviation band — both anchored to a percentile-based median. The asymmetric design uses different volatility measures for long and short signals, creating a natural bias toward staying in bullish trends longer while reacting quickly to breakdowns.
The result is an area oscillator that expands above zero in a confirmed bullish state and contracts below zero in a bearish state, with a white EMA line as a momentum confluence filter.
How It Works
A percentile median is calculated from a configurable price source — giving a robust, noise-resistant central reference level that adapts to recent price behavior.
Two independent volatility bands are then derived from this median:
ATR Band — median plus ATR multiplied by a configurable factor. The short condition uses the ATR band — price must fall below it to confirm a bearish state
SD Band — median plus the standard deviation of close. The long condition uses the standard deviation band — price must break above it to confirm a bullish state
Once a directional state is confirmed, the oscillator measures the distance between price and its reference level. An EMA of this distance acts as a confluence filter — the final signal only confirms when the distance is not only positive or negative but also above or below its own EMA, ensuring momentum is genuinely building in that direction.
Why This Approach Works
Most oscillators use a single volatility measure for both long and short signals. The Median ATR SD Oscillator deliberately uses two different measures — ATR for shorts and SD for longs — because they capture different market dynamics and create a natural asymmetry between entries and exits.
This asymmetric design reflects the structural reality of markets like crypto — price spends more time trending upward than downward. Longs require a statistically significant breakout above the SD band, while shorts only need price to fall back below the ATR band. The result is a system that stays in bullish trends longer while reacting quickly when momentum fades.
Settings
Median Source — Price source for the percentile median calculation (default: hl2)
Median Length — Lookback period for the percentile median (default: 63)
ATR Length — Lookback period for the ATR calculation (default: 4)
ATR Factor — Controls the width of the ATR band (default: 1.0)
SD Length — Lookback period for the standard deviation calculation (default: 29)
Use EMA — Enables the EMA confluence filter (default: true)
EMA Length — Lookback period for the EMA confluence filter (default: 35)
Use Bar Coloring — Colors bars based on the current state (default: true)
Color Background — Enables background coloring of the chart based on the current state (default: false)
Background Transparency — Controls the transparency of the background color (default: 85)
How to trade it
Long — when the oscillator expands above zero and the area turns blue, a bullish state has been confirmed. This is the signal to look for long entries or to hold existing long positions
Short / Cash — when the oscillator contracts below zero and the area turns red, the momentum has faded. This is the signal to exit longs, move to cash, or look for short entries depending on your strategy
EMA line — when the area is above the white EMA line momentum is building, when it crosses below momentum is weakening
Recommended Usage
Best used on the 1D timeframe for clean and reliable signal generation
Should not be used alone for trade entries — combine with an additional confirmation indicator for best results
The asymmetric ATR/SD design makes this oscillator particularly well suited for bullish-biased markets like crypto
Higher ATR Factor values make short exits more sensitive — lower values make them less reactive
Higher SD Length values create more stable long signals — lower values make them more reactive to short-term price movements
All signals are confirmed on bar close.
مؤشر Pine Script®






















