Plots common futures reference levels on the price chart: previous day high, low and close, overnight high and low, the opening range, VWAP with bands, round numbers and a session background.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
158 lines of Pine Script v6 from pine/key_levels.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
key_levels.pine
//@version=6
indicator("Key Levels — Futures Signal Engine", overlay=true, max_lines_count=500, max_labels_count=500)
// ── Inputs ──────────────────────────────────────────────────────────────────
showPD = input.bool(true, "Previous Day Levels")
showON = input.bool(true, "Overnight Levels")
showOR = input.bool(true, "Opening Range")
showVWAP = input.bool(true, "VWAP + Bands")
showRound = input.bool(true, "Round Numbers")
showSession = input.bool(true, "Session Background")
orMinutes = input.int(15, "Opening Range Minutes", minval=5, maxval=60, step=5)
roundInc = input.int(50, "Round Number Increment", options=[25, 50, 100, 250, 500])
// ── Session definitions (ET) ────────────────────────────────────────────────
rthSess = input.session("0930-1600", "RTH Session")
ethSess = input.session("1800-0930", "ETH Session")
isRTH = not na(time(timeframe.period, rthSess, "America/New_York"))
isETH = not na(time(timeframe.period, ethSess, "America/New_York"))
nyHour = hour(time, "America/New_York")
nyMinute = minute(time, "America/New_York")
nyTime = nyHour + nyMinute / 60.0
// ── Previous Day High / Low / Close ─────────────────────────────────────────
[pdh, pdl, pdc] = request.security(syminfo.tickerid, "D", [high[1], low[1], close[1]], lookahead=barmerge.lookahead_on)
var line pdh_line = na
var line pdl_line = na
var line pdc_line = na
var label pdh_lbl = na
var label pdl_lbl = na
var label pdc_lbl = na
if showPD and barstate.islast
// Clean up old
if not na(pdh_line)
line.delete(pdh_line)
line.delete(pdl_line)
line.delete(pdc_line)
label.delete(pdh_lbl)
label.delete(pdl_lbl)
label.delete(pdc_lbl)
pdh_line := line.new(bar_index - 50, pdh, bar_index + 5, pdh, color=color.red, width=2)
pdl_line := line.new(bar_index - 50, pdl, bar_index + 5, pdl, color=color.green, width=2)
pdc_line := line.new(bar_index - 50, pdc, bar_index + 5, pdc, color=color.blue, width=1, style=line.style_dashed)
pdh_lbl := label.new(bar_index + 6, pdh, "PDH " + str.tostring(pdh, format.mintick), style=label.style_none, textcolor=color.red, size=size.small)
pdl_lbl := label.new(bar_index + 6, pdl, "PDL " + str.tostring(pdl, format.mintick), style=label.style_none, textcolor=color.green, size=size.small)
pdc_lbl := label.new(bar_index + 6, pdc, "PDC " + str.tostring(pdc, format.mintick), style=label.style_none, textcolor=color.blue, size=size.small)
// ── Overnight High / Low ────────────────────────────────────────────────────
var float onHigh = na
var float onLow = na
// Reset at ETH start (18:00 ET)
isETHStart = nyHour == 18 and nyMinute < (timeframe.in_seconds() / 60)
if isETHStart
onHigh := high
onLow := low
// Track during ETH before RTH open
if isETH and not isRTH
onHigh := math.max(nz(onHigh, high), high)
onLow := math.min(nz(onLow, low), low)
var line onh_line = na
var line onl_line = na
var label onh_lbl = na
var label onl_lbl = na
if showON and barstate.islast and not na(onHigh)
if not na(onh_line)
line.delete(onh_line)
line.delete(onl_line)
label.delete(onh_lbl)
label.delete(onl_lbl)
onh_line := line.new(bar_index - 50, onHigh, bar_index + 5, onHigh, color=color.red, width=1, style=line.style_dotted)
onl_line := line.new(bar_index - 50, onLow, bar_index + 5, onLow, color=color.green, width=1, style=line.style_dotted)
onh_lbl := label.new(bar_index + 6, onHigh, "ONH " + str.tostring(onHigh, format.mintick), style=label.style_none, textcolor=color.red, size=size.small)
onl_lbl := label.new(bar_index + 6, onLow, "ONL " + str.tostring(onLow, format.mintick), style=label.style_none, textcolor=color.green, size=size.small)
// ── Opening Range ───────────────────────────────────────────────────────────
var float orHigh = na
var float orLow = na
var bool orDone = false
isRTHOpen = nyHour == 9 and nyMinute == 30
if isRTHOpen
orHigh := high
orLow := low
orDone := false
orEndMinute = 30 + orMinutes
orEndHour = 9 + orEndMinute / 60
orEndMin = orEndMinute % 60
inOR = isRTH and not orDone and (nyHour == 9 and nyMinute >= 30 or (nyHour == orEndHour and nyMinute < orEndMin and orEndHour > 9))
if inOR and nyHour == 9 and nyMinute >= 30
orHigh := math.max(nz(orHigh, high), high)
orLow := math.min(nz(orLow, low), low)
if isRTH and nyHour * 60 + nyMinute >= orEndHour * 60 + orEndMin
orDone := true
var line orh_line = na
var line orl_line = na
var label orh_lbl = na
var label orl_lbl = na
if showOR and barstate.islast and orDone and not na(orHigh)
if not na(orh_line)
line.delete(orh_line)
line.delete(orl_line)
label.delete(orh_lbl)
label.delete(orl_lbl)
orh_line := line.new(bar_index - 50, orHigh, bar_index + 5, orHigh, color=color.yellow, width=3)
orl_line := line.new(bar_index - 50, orLow, bar_index + 5, orLow, color=color.yellow, width=3)
orh_lbl := label.new(bar_index + 6, orHigh, "OR High " + str.tostring(orHigh, format.mintick), style=label.style_none, textcolor=color.yellow, size=size.small)
orl_lbl := label.new(bar_index + 6, orLow, "OR Low " + str.tostring(orLow, format.mintick), style=label.style_none, textcolor=color.yellow, size=size.small)
// ── VWAP + Bands ────────────────────────────────────────────────────────────
// Using built-in ta.vwap with standard deviation bands
vwapVal = ta.vwap(hlc3)
vwapDev = ta.stdev(hlc3 - vwapVal, 20)
plot(showVWAP ? vwapVal : na, "VWAP", color=color.purple, linewidth=2)
plot(showVWAP ? vwapVal + vwapDev : na, "VWAP +1σ", color=color.new(color.purple, 70), linewidth=1)
plot(showVWAP ? vwapVal - vwapDev : na, "VWAP -1σ", color=color.new(color.purple, 70), linewidth=1)
plot(showVWAP ? vwapVal + 2 * vwapDev : na, "VWAP +2σ", color=color.new(color.purple, 85), linewidth=1, style=plot.style_dotted)
plot(showVWAP ? vwapVal - 2 * vwapDev : na, "VWAP -2σ", color=color.new(color.purple, 85), linewidth=1, style=plot.style_dotted)
// ── Round Numbers ───────────────────────────────────────────────────────────
if showRound and barstate.islast
float baseLevel = math.floor(close / roundInc) * roundInc
for i = -3 to 3
float lvl = baseLevel + i * roundInc
line.new(bar_index - 50, lvl, bar_index + 5, lvl, color=color.new(color.gray, 70), width=1)
// ── Session Background Shading ──────────────────────────────────────────────
preMarket = nyTime >= 4.0 and nyTime < 9.5
nyOpen = nyTime >= 9.5 and nyTime < 11.0
lunch = nyTime >= 11.0 and nyTime < 13.0
afternoon = nyTime >= 13.0 and nyTime < 15.0
mktClose = nyTime >= 15.0 and nyTime < 16.0
bgColor = showSession ?
preMarket ? color.new(color.blue, 95) :
nyOpen ? color.new(color.green, 95) :
lunch ? color.new(color.yellow, 95) :
afternoon ? color.new(color.green, 95) :
mktClose ? color.new(color.orange, 95) :
na : na
bgcolor(bgColor)
Overview
Sessions use New York time, with a regular session of 0930 to 1600 and an extended session of 1800 to 0930, both editable. The opening range length and round number step are inputs. Previous day data is requested with lookahead enabled. It gives no trade signals.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Previous Day Levels
bool
true
showPD
Overnight Levels
bool
true
showON
Opening Range
bool
true
showOR
VWAP + Bands
bool
true
showVWAP
Round Numbers
bool
true
showRound
Session Background
bool
true
showSession
Opening Range Minutes
int
15
orMinutes
Round Number Increment
int
50
roundInc
RTH Session
session
0930-1600
rthSess
ETH Session
session
1800-0930
ethSess
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.
This indicator builds Market Profile Time Price Opportunity (TPO) structures across defined session timeframes directly on the main price chart. It visualizes the Point of Control (POC) and Value Area boundaries using dynamic box drawings. An integrated multi-
This indicator plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds
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 plots reference levels for previous daily high and low prices directly on the price chart. It requests daily timeframe data using the security function and plots the offset values as continuous lines, displaying resistance in red and support in
This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow
This indicator plots reference levels and session markers directly on the price chart. It calculates and draws lines for the daily open, weekly open, monthly open, previous day OHLC, and previous week extremes, along with a selectable day-of-week range and ini