TradingView indicator guides

Premarket High and Low: Session Boundaries and Pine Script | Pineify

Premarket highs and lows depend on which bars the chart actually supplies and which time window the script includes. This example uses weekday 04:00–09:30 America/New_York observations, then retains the observed range for that calendar day. It does not infer order placement, trader identity, or the probability that a breakout will succeed.

Inspect the Pine Script

Specify the session before calling its levels premarket

Nasdaq defines pre-market hours as 04:00–09:30 Eastern on business days. This is the window used here, not a claim that every broker or feed supplies every trade throughout that window. The script uses the IANA zone America/New_York so daylight-saving changes do not require a manual fixed-UTC adjustment.

The chart must include extended-hours observations. The script reads existing chart high and low values; it does not retrieve missing intraday bars from another feed. On a regular-hours-only chart, it has no eligible premarket observations and leaves that day’s range missing. A calendar reset prevents yesterday’s range from silently standing in for today’s missing data.

This teaching implementation supports standard 1, 5, 15 and 30 minute charts. It includes only bars whose opening and closing timestamps fit completely inside the window. A 09:25–09:30 five-minute bar qualifies; a bar opening at 09:30 does not. This avoids mixing regular-session price action into the range.

See Pine session and timezone behavior and TradingView session-data controls. The indicator has no exchange holiday calendar; it operates on the weekday bars actually supplied.

A boundary fixture you can check without trading results

Assume a five-minute chart and the following selected hypothetical bars on one New York weekday. Intermediate bars are omitted for this small test; this is not a complete premarket dataset or a backtest.

Only fully contained premarket bars enter the range
Bar intervalHigh / lowIncluded?Stored high / low
03:55–04:00120 / 90NoMissing
04:00–04:05102 / 100Yes102 / 100
08:00–08:05104 / 99Yes104 / 99
09:25–09:30103 / 100Yes104 / 99
09:30–09:35110 / 98No104 / 99
16:00–16:05112 / 95No104 / 99

The 09:30 and 16:00 bars do not update the range. On the next calendar date, stored values reset before collection. If that date has no premarket bars, both levels stay missing rather than displaying 104 and 99 again.

The Data Window reports observed eligible bar count. A complete 5-minute 04:00–09:30 window normally has 66 time slots, but missing bars, halts and feed coverage can reduce observations. A price extreme omitted by the feed cannot be recovered from the remaining chart bars.

Freeze the ATR reference separately from the range

The upper extension is observed premarket high + factor × ATR reference. The lower extension is observed premarket low − factor × ATR reference. With high 104, low 99, prior regular-day ATR 2.5 and factor 1, the extensions are 106.5 and 96.5. Factor 0.5 gives 105.25 and 97.75. These are arithmetic reference levels, not forecast targets or hit probabilities.

The script requests the previous completed regular-session daily ATR(14) using an expression offset of one daily bar together with lookahead_on. It latches that value at the first available chart bar at or after 09:30, then keeps it for the calendar day. Extensions remain missing before that latch or if a valid daily ATR is unavailable. The daily request uses a regular-session ticker context; it is distinct from the extended intraday bars used for premarket extrema.

That explicit timing avoids presenting an evolving current daily ATR as a fixed daily value. The offset and lookahead setting must stay together: requesting the unoffset current value with lookahead_on would expose future daily information on historical bars. TradingView documents the confirmed higher-timeframe pattern.

Daily data can differ from an aggregation of chart bars. Match the symbol, session and adjustments and inspect the reference in the Data Window. After latching, a regular-session volatility spike does not expand these same-day extensions. Changing inputs or data and rerunning the script can change historical output.

What changed from the old helper

The earlier copy used a 1440-minute session timestamp to decide resets but a separate clock predicate to update extrema. That predicate included every hour at or after 16 even when the aftermarket argument was false, and had no explicit 04:00 start. Its bare hour and minute variables used the exchange timezone rather than an explicit New York timezone.

It also requested the unconfirmed current daily ATR and used a −9999 plot offset with price tracking. Those choices did not justify claims of a stable, non-repainting 04:00–09:30 range. Hiding plots outside intraday charts did not suppress only the ATR lines on one-hour charts; all four old plots used the same intraday condition.

The replacement below is an explicit educational implementation, not a silent promise that every Pineify product helper was updated. It removes the aftermarket toggle and replaces ambiguous session detection with calendar timestamps and fully contained bars. Other markets require a separately defined session and trading-day policy, especially overnight futures sessions and continuously trading crypto.

Live values, retained levels and strategy timing

During premarket, the current eligible bar’s high and low can change, so the running range can change. After the window closes, the observed extrema remain fixed for that calendar day. The script performs its accumulation on every bar update; it does not rely on an opening-tick-only initialization that would be lost during realtime rollback.

The four plots retain their calculated historical series and have no negative offset. A chart can visually connect adjacent available values across a date change if there is no missing plotted bar between them; inspect the date and Data Window rather than treating that connector as a traded price. The example provides no breakout markers, alert conditions or orders.

If you add a breakout rule, distinguish a wick beyond a level from a close beyond it and a persistent above-level state from a new crossing. Use only range observations available before the event. A conventional opening range uses the first minutes after the regular open; it is not the premarket range. VWAP is a volume-weighted average with its own anchor and session, not inherently a regular-session-only or tick-weighted replacement.

None of these levels reveals where institutions placed orders or guarantees resistance, support or a profitable fill. Any strategy needs exits, position sizing, fees, slippage and evaluation on separate data. This page claims no backtest win rate or observed ticker-specific performance.

Pine Script v6: implementation and limits

This replacement uses explicit New York timestamps, daily resets and a fixed confirmed daily ATR reference. Select extended hours on a supported standard intraday chart. Inspect the boundary fixture and ATR latch timing; the script places no orders and does not claim complete feed coverage.

Pine Script v6
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (c) Pineify
//@version=6
indicator("Premarket 04:00–09:30 New York: explicit window", overlay=true)

const string ZONE = "America/New_York"
atrFactor = input.float(1.0, "Prior regular-day ATR extension", minval=0.0, step=0.1)
if not chart.is_standard
    runtime.error("Use standard time-based candles, not synthetic chart prices.")
if not timeframe.isminutes or not (timeframe.multiplier == 1 or timeframe.multiplier == 5 or timeframe.multiplier == 15 or timeframe.multiplier == 30)
    runtime.error("This teaching example supports 1, 5, 15 or 30 minute charts.")

y = year(time, ZONE)
m = month(time, ZONE)
d = dayofmonth(time, ZONE)
dayKey = y * 10000 + m * 100 + d
newDay = barstate.isfirst or dayKey != dayKey[1]
windowStart = timestamp(ZONE, y, m, d, 4, 0)
windowEnd = timestamp(ZONE, y, m, d, 9, 30)
weekday = dayofweek(time, ZONE) >= dayofweek.monday and dayofweek(time, ZONE) <= dayofweek.friday
inside = weekday and time >= windowStart and time < windowEnd and not na(time_close) and time_close <= windowEnd

var float preHigh = na
var float preLow = na
var float fixedAtr = na
var int observedBars = 0
if newDay
    preHigh := na
    preLow := na
    fixedAtr := na
    observedBars := 0
if inside
    preHigh := na(preHigh) ? high : math.max(preHigh, high)
    preLow := na(preLow) ? low : math.min(preLow, low)
    observedBars += 1

// Request confirmed prior regular-session daily ATR; expose extensions only
// once this day's regular opening time has arrived, then retain the value.
regularTicker = ticker.modify(syminfo.tickerid, session=session.regular)
priorDailyAtr = request.security(regularTicker, "1D", ta.atr(14)[1], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
if weekday and time >= windowEnd and na(fixedAtr) and not na(priorDailyAtr)
    fixedAtr := priorDailyAtr
upper = preHigh + fixedAtr * atrFactor
lower = preLow - fixedAtr * atrFactor
plot(preHigh, "Observed premarket high", color=color.yellow, linewidth=2, style=plot.style_linebr)
plot(preLow, "Observed premarket low", color=color.orange, linewidth=2, style=plot.style_linebr)
plot(upper, "Premarket high plus fixed prior-day ATR", color=color.blue, style=plot.style_linebr)
plot(lower, "Premarket low minus fixed prior-day ATR", color=color.purple, style=plot.style_linebr)
plot(observedBars, "Observed premarket bars", display=display.data_window)
plot(fixedAtr, "Fixed prior regular-day ATR", display=display.data_window)

Specify a checkable adaptation in Pineify

Give the Pine Script AI Coding Agent the timezone, exact start and end boundaries, weekday or trading-day policy, missing-session behavior and ATR confirmation rule. For another market, define its overnight calendar separately. Request intermediate values and compare the 09:25, 09:30, 16:00 and next-day cases before adding alerts or strategy rules.

Open Pine Script AI Coding Agent

Educational indicator analysis. No measured trading performance is established here. Syntax validation does not prove formula equivalence, execution assumptions or profitability.

Implementation questions

Weekday 04:00–09:30 in America/New_York, using only fully contained chart bars. It is an explicit Nasdaq-style window, not an automatic calendar for every exchange.

The calculation uses chart high and low values. Without eligible extended-hours bars it cannot calculate that day’s premarket range, and it deliberately does not carry yesterday’s values forward.

No. Bars at or after 09:30, including 16:00 after-hours bars, cannot update the range. An overnight-session variant requires different boundaries and reset rules.

After the first available bar at or after 09:30 captures the previous completed regular-session daily ATR. They remain missing before then or when that reference is unavailable.

They can change while an eligible premarket bar is open. They stop accumulating after the window; historical data revisions or input changes can still change recalculated values.

No. The script plots an observed range and ATR extensions. It has no alert conditions, breakout detector or order placement.

It can calculate a chosen clock window, but that would not automatically be the market’s premarket session. Define the intended exchange timezone, overnight trading date and data coverage first.