indicator · on price · open source
Premium / Discount Zone indicator
Premium / Discount Zone is a free open-source indicator. Premium / Discount Zone shades the chart background relative to the 50% midpoint of the… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Premium / Discount Zone does
Premium / Discount Zone shades the chart background relative to the 50% midpoint of the recent swing range.
- Above 50% = premium (red shade, look for shorts).
- Below 50% = discount (green shade, look for longs).
- Range derives from the rolling high / low over
lookbackbars. - The zone resets each time a new swing high or low is confirmed.
- Pair with a directional CHoCH for the cleanest setups.
- A 'premium sweep' that hits the swing high and reverses is the highest-probability short entry.
- The 50% line is the 'equilibrium'; expect price to oscillate around it in ranging conditions.
- Default lookback = 20 — captures the most recent 20-bar range.
- The shaded background fills the area between the recent high and low for instant context.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Premium / Discount Zone", overlay=true)
lookback = input.int(20, "Lookback", minval=5, maxval=100)
premiumColor = input.string("color.red", "Premium Shade")
discountColor = input.string("color.green", "Discount Shade")
showEq = input.bool(true, "Show Equilibrium Line")
transparency = input.int(90, "Shade Transparency", minval=70, maxval=99)
alertZone = input.bool(true, "Alert on Zone Cross")
alertSweep = input.bool(false, "Alert on Premium/Discount Sweep")
alertEqCross = input.bool(false, "Alert on Equilibrium Cross")
eqColor = input.string("color.yellow", "Equilibrium Line Color")
colorDown = input.color("color.red", "Color Down")
colorUp = input.color("color.green", "Color Up")
colorFill = input.color("color.yellow", "Color Fill")
rh = ta.highest(high, lookback)
rl = ta.lowest(low, lookback)
mid = (rh + rl) / 2
inPremium = close > mid
bgcolor(inPremium ? color.new(colorDown, 90) : color.new(colorUp, 90))
p_High = plot(rh, "High", color=premiumColor, style=plot.style_linebr)
p_Low = plot(rl, "Low", color=discountColor, style=plot.style_linebr)
p_Equilibrium = plot(showEq ? mid : na, "Equilibrium", color=colorFill, linewidth=2)
fill(p_High, p_Low, color=inPremium ? color.new(premiumColor, transparency) : color.new(discountColor, transparency))
alertcondition(inPremium and not inPremium[1], "Entered premium", "Price entered the premium zone")
alertcondition(not inPremium and inPremium[1], "Entered discount", "Price entered the discount zone")
alertcondition(inPremium and high >= rh and close < rh, "Premium sweep", "Price swept the swing high and closed back below")
alertcondition(not inPremium and low <= rl and close > rl, "Discount sweep", "Price swept the swing low and closed back above")
alertcondition(ta.crossover(close, mid) and inPremium[1], "Crossed to premium", "Price crossed equilibrium into premium")
No comments yet.
Sign in to comment.