This indicator identifies whether the opening bar of a new trading day opens at its high (Open = High) or low (Open = Low) within a customizable tick tolerance.
//@version=5
indicator("Zen OOH OOL v3", overlay=true, max_labels_count=500)
// ============================================================
// INPUTS
// ============================================================
grpLogic = "Logic"
tolTicks = input.int(0, "Tolerance (ticks)", minval=0, group=grpLogic,
tooltip="0 = exact match. Increase to allow open within N ticks of HOD/LOD.")
grpDisplay = "Display"
showArrows = input.bool(true, "Show arrows", group=grpDisplay)
showLabels = input.bool(true, "Show arrow labels", group=grpDisplay)
showBg = input.bool(true, "Highlight opening bar", group=grpDisplay)
bgTransp = input.int(85, "Background transparency", minval=50, maxval=99, group=grpDisplay,
tooltip="Higher = more translucent. 85 is a good scroll-friendly default.")
showTable = input.bool(true, "Show stats table", group=grpDisplay)
grpColors = "Colors"
colOL = input.color(color.new(#26a69a, 0), "Open = Low (bullish)", group=grpColors)
colOH = input.color(color.new(#ef5350, 0), "Open = High (bearish)", group=grpColors)
grpAlerts = "Alerts"
alertOL = input.bool(true, "Alert on Open = Low", group=grpAlerts)
alertOH = input.bool(true, "Alert on Open = High", group=grpAlerts)
// ============================================================
// SESSION DETECTION — first bar of new day
// ============================================================
isNewDay = dayofweek != dayofweek[1]
// ============================================================
// LOGIC
// ============================================================
tol = tolTicks * syminfo.mintick
opensOnLow = isNewDay and math.abs(open - low) <= tol
opensOnHigh = isNewDay and math.abs(open - high) <= tol
// ============================================================
// BAR HIGHLIGHT (translucent, one-bar vertical band)
// ============================================================
bgcolor(showBg and opensOnLow ? color.new(colOL, bgTransp) : na, title="O=L highlight")
bgcolor(showBg and opensOnHigh ? color.new(colOH, bgTransp) : na, title="O=H highlight")
// ============================================================
// PLOTS
// ============================================================
plotshape(showArrows and showLabels and opensOnLow,
title="Open = Low (labeled)", style=shape.arrowup, location=location.belowbar,
color=colOL, size=size.normal, text="O=L")
plotshape(showArrows and not showLabels and opensOnLow,
title="Open = Low", style=shape.arrowup, location=location.belowbar,
color=colOL, size=size.normal)
plotshape(showArrows and showLabels and opensOnHigh,
title="Open = High (labeled)", style=shape.arrowdown, location=location.abovebar,
color=colOH, size=size.normal, text="O=H")
plotshape(showArrows and not showLabels and opensOnHigh,
title="Open = High", style=shape.arrowdown, location=location.abovebar,
color=colOH, size=size.normal)
// ============================================================
// STATS TABLE (top right)
// ============================================================
var int countDays = 0
var int countOL = 0
var int countOH = 0
if isNewDay
countDays += 1
if opensOnLow
countOL += 1
if opensOnHigh
countOH += 1
var table stats = table.new(position.top_right, 2, 5,
bgcolor=color.new(color.white, 0), border_color=color.new(color.gray, 70), border_width=1)
f_pct(x, n) => n == 0 ? "–" : str.tostring(100.0 * x / n, "#.0") + "%"
if showTable and barstate.islast
table.clear(stats, 0, 0, 1, 4)
table.cell(stats, 0, 0, "Zen O=HOD/LOD", text_color=color.black, bgcolor=color.new(color.gray, 85), text_size=size.small)
table.cell(stats, 1, 0, syminfo.ticker, text_color=color.black, bgcolor=color.new(color.gray, 85), text_size=size.small)
table.cell(stats, 0, 1, "Days", text_color=color.black, text_size=size.small)
table.cell(stats, 1, 1, str.tostring(countDays), text_color=color.black, text_size=size.small)
table.cell(stats, 0, 2, "Open=Low", text_color=color.black, text_size=size.small)
table.cell(stats, 1, 2, str.tostring(countOL) + " (" + f_pct(countOL, countDays) + ")",
text_color=color.black, text_size=size.small)
table.cell(stats, 0, 3, "Open=High", text_color=color.black, text_size=size.small)
table.cell(stats, 1, 3, str.tostring(countOH) + " (" + f_pct(countOH, countDays) + ")",
text_color=color.black, text_size=size.small)
table.cell(stats, 0, 4, "Either", text_color=color.black, text_size=size.small)
table.cell(stats, 1, 4, str.tostring(countOL + countOH) + " (" + f_pct(countOL + countOH, countDays) + ")",
text_color=color.black, text_size=size.small)
// ============================================================
// ALERTS
// ============================================================
if alertOL and opensOnLow
alert("Open = LOW on " + syminfo.ticker + " — bullish shave, fade down toward open", alert.freq_once_per_bar_close)
if alertOH and opensOnHigh
alert("Open = HIGH on " + syminfo.ticker + " — bearish shave, fade up toward open", alert.freq_once_per_bar_close)
Overview
Zen OOH OOL v3 marks matching sessions directly on the price chart using directional arrows, text labels, and translucent background highlights. It also compiles historical occurrence counts into an on-chart statistics table in the top-right corner and provides alert triggers for both conditions.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Tolerance (ticks)
int
0
tolTicks
Show arrows
bool
true
showArrows
Show arrow labels
bool
true
showLabels
Highlight opening bar
bool
true
showBg
Background transparency
int
85
bgTransp
Show stats table
bool
true
showTable
Open = Low (bullish)
color
color.new(#26a69a, 0)
colOL
Open = High (bearish)
color
color.new(#ef5350, 0)
colOH
Alert on Open = Low
bool
true
alertOL
Alert on Open = High
bool
true
alertOH
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr
This indicator plots a 200-period weighted moving average (WMA) on the main chart and monitors price deviations across multiple timeframes. It retrieves daily, 15-minute, 5-minute, and 2-minute price data to track distance from the 200 WMA relative to key sess
The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh
Indicatorv6SMC / ICT / price actionSessions & time
This indicator classifies the market into gamma regime types (negative gamma trend, positive gamma mean-reversion, or transition) by calculating a composite score based on daily ATR ratios, session VWAP crossover frequencies, and opening range displacement. It
This overlay indicator highlights candles with a body smaller than 50% of their total range by coloring them white on the price chart. Simultaneously, it calculates and plots horizontal lines for open prices across multiple higher timeframes, such as daily, we