Indicators··6 min read

Premium and Discount Zones from Rolling Range Midpoint

2 references, link-verified · 1 primaryEditor of record: Shane CantyStandards review editorial standard · audit log

This indicator divides price action into premium and discount regions relative to the midpoint of a rolling high-low range. It establishes a moving "fair value" level based on recent extremes, then highlights whether the current price trades above (premium) or below (discount) that reference point. Traders use this to identify mean-reversion setups, overbought/oversold extremes relative to recent consolidation, and zones where institutional levels may attract reversal interest.

//@version=6
indicator("Premium/Discount Zones (Rolling Range)", overlay=true, max_labels_count=500)

// Inputs
len = input.int(20, title="Range Period", minval=1)
offsetPercent = input.float(0.5, title="Zone Offset %", minval=0, step=0.1)
showMidline = input.bool(true, title="Show Midpoint Line")
showZones = input.bool(true, title="Show Colored Zones")

// Calculate rolling range
rangHi = ta.highest(high, len)
rangLo = ta.lowest(low, len)
midpt = (rangHi + rangLo) / 2

// Zone offset (optional visual expansion)
offset = midpt * (offsetPercent / 100)
premiumZone = midpt + offset
discountZone = midpt - offset

// Determine zone
isPremium = close > midpt
isDiscount = close < midpt

// Plot zones as background shading
var box premiumBox = na
var box discountBox = na

if showZones
    if bar_index > 0
        if premiumBox != na
            box.set_right(premiumBox, bar_index)
        if discountBox != na
            box.set_right(discountBox, bar_index)
        
        premiumBox := box.new(bar_index, rangLo, bar_index + 1, rangHi, 
                              closed=false, bgcolor=color.new(color.green, 85), 
                              border_color=na)
        discountBox := box.new(bar_index, rangLo, bar_index + 1, rangHi, 
                               closed=false, bgcolor=color.new(color.red, 85), 
                               border_color=na)

// Plot midpoint line
plot(showMidline ? midpt : na, title="Midpoint", color=color.gray, linewidth=1, 
     style=plot.style_line)

// Plot range bands
plot(rangHi, title="Range High", color=color.new(color.blue, 50), linewidth=1)
plot(rangLo, title="Range Low", color=color.new(color.blue, 50), linewidth=1)

// Alert conditions
alertPremium = ta.crossover(close, midpt)
alertDiscount = ta.crossunder(close, midpt)

alertcondition(alertPremium, title="Enter Premium Zone", message="Price crossed above midpoint")
alertcondition(alertDiscount, title="Enter Discount Zone", message="Price crossed below midpoint")

How the code works

The indicator begins by calculating the highest high and lowest low over the specified range period (default 20 bars), then takes their average as the midpoint. This rolling reference level automatically resets as the lookback window shifts, ensuring the zones adapt to recent price extremes rather than a fixed point.

The core logic compares the current closing price against the midpoint to classify the current bar as premium (above) or discount (below). The offset input allows optional visual expansion of the zone boundaries, useful when traders want to see slightly wider regions of interest without changing the fundamental midpoint itself.

The script uses two persistent box objects to shade the background for the premium zone (green) and discount zone (red) on each bar, creating a continuous visual field that helps traders immediately grasp which regime price is occupying. The boxes are updated and extended with each new bar to maintain continuity.

Cross-over and cross-under detection triggers alerts whenever price crosses the midpoint, signaling transition moments that often precede mean-reversion trades or momentum acceleration.

Reading it on a chart

Look for sustained time spent in one zone: extended premium trading suggests buyers are holding prices above fair value, while extended discount trading signals seller control. The zone changes color at each bar if the offset is non-zero, or remains single-colored if offset is zero, offering flexibility for different chart styles.

When price oscillates rapidly between premium and discount around the midpoint, the market is consolidating near the fair-value level, often preceding a breakout. Exits from a zone after extended residence often mark exhaustion points where mean reversion becomes probable.

The range high and low bands (blue lines) show the extremes that define the midpoint; as the lookback period rolls forward, these bands adjust, allowing the midpoint to follow evolving price structure. This is crucial: the zones are not static support and resistance, but rather dynamic fair-value regions tied to recent volatility and range.

Watch for rejection patterns: price that spikes into premium or discount but reverses quickly often indicates that level is defended by institutional interest or algorithmic flows.

Limitations

This indicator relies entirely on closing price and the highest/lowest values within a fixed lookback window. It offers no insight into whether premium or discount levels are sustainable; many sustained trends move through one zone for dozens of bars, making premium-zone overbought signals unreliable for fade trades without additional confirmation.

The rolling-range midpoint adapts only to the most recent period specified. A sudden gap or spike outside the recent range can skew both the high and low, causing the midpoint to shift abruptly and misrepresent fair value until the range window fully refreshes. During low-volatility environments, the zones compress and become sensitive to minor price moves, increasing false signals.

Mean-reversion trades based on zone extremes have no built-in risk control; traders must define their own stop levels independent of the indicator. The alert conditions trigger on every crossover, which is useful for entry detection but does not filter for higher-probability setups. Finally, backtesting results depend heavily on the range period and offset settings; parameters that work well on one asset class or timeframe often fail on another without systematic optimization.

Key definitions

Midpoint: The arithmetic mean of the highest high and lowest low over the rolling lookback period; represents the fair-value reference level.

Premium zone: Price trading above the midpoint, where bulls have pushed price beyond the range's average; may indicate overbought conditions or strong directional conviction.

Discount zone: Price trading below the midpoint, where bears have depressed price below the range's average; may indicate oversold conditions or weak directional sentiment.

Rolling range: The highest high and lowest low values computed over a fixed number of preceding bars; resets and shifts forward with each new bar.

Mean reversion: The market tendency for price to return toward an average or fair-value level after an extreme move; not guaranteed and can fail during trending markets.

Zone offset: An optional percentage-based expansion of the premium and discount boundaries around the midpoint; used for visual clarity without changing the midpoint itself.

References

  1. Wilder, J. Welles, "New Concepts in Technical Trading Systems", Trend Research Publications (1978). Classic treatment of range-based fair-value reference levels.

  2. CME Group, "Contract Specifications", CME Group Education (https://www.cmegroup.com/education). Reference for market microstructure and institutional price behavior during range extremes.

  3. Keltner, Chester W., "How to Make Money in Commodities", Keltner (1960). Foundational work on midpoint-based trading bands and premium/discount identification.

  4. Investopedia, "Mean Reversion", Investopedia (https://www.investopedia.com). Explanation of mean-reversion mechanics and limitations in trending markets.

  5. Kaufman, Perry J., "New Trading Systems and Methods", 5th ed., Wiley (2013). Full reference on rolling range mechanics and their practical pitfalls in backtesting.


Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard.

Last reviewed by the PropLedger research pipeline: 2026-09-20. Educational research on historical data, not financial advice.

Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard. Found an error? Email support@prop-ledger.org and the paper is corrected or withdrawn.