TradingView indicator guides

Previous Day High and Low: Confirmed Daily Levels in Pine Script

This example draws the high and low of the previous completed daily bar on a standard intraday chart. The daily offset belongs inside the data request. An unshifted request for daily high or low can include the developing current day and does not implement the same reference.

Inspect the Pine Script

What the four requested values mean

The requested tuple contains the previous daily high, low, close and open. Only high and low appear on the price chart; open and close remain available in the Data Window. There are no configurable inputs, automatic orders or alert conditions.

“Previous” means the preceding bar in the requested daily series, not necessarily yesterday on a calendar. A weekend or holiday can separate two trading bars. The example inherits the chart symbol context through syminfo.tickerid; it does not force a US regular-hours session or calculate a custom midnight-to-midnight range.

The offset and lookahead must work together

Each [1] is evaluated inside the daily request. With lookahead_on, the last completed daily values become available at the start of the next requested daily period. Using lookahead with an unshifted daily high would instead leak a completed day's future high into historical intraday bars.

Moving [1] outside request.security() would shift the returned series by one chart bar. On a five-minute chart, that is a five-minute-bar offset, not a daily offset. Pine Script v6 does not automatically interpret an unshifted high as high[1].

TradingView's higher-timeframe request documentation explains the confirmed-value pattern. This page deliberately replaces the earlier unshifted example; it does not establish that every Pineify-generated version uses this implementation.

A synthetic daily-boundary check

Chart periodRequested prior daily high / lowExpected plotted levels
Today, after yesterday completed at H 105 / L 95105 / 95105 / 95
Today later reaches H 110 / L 94Still 105 / 95Still 105 / 95
Next daily period, after today completes at H 110 / L 94110 / 94110 / 94

If yesterday opened at 98 and closed at 102, those two values also remain unchanged in today's Data Window. The example describes an assumed sequence, not a measured market reaction or a TradingView runtime test.

The step plots preserve each historical day's own reference. They do not extend today's two prices backward across the entire chart. A vertical step at a daily boundary is a change in the reference period, not an intraday trade signal.

Session context and data revisions

Compare the output with the same symbol's daily chart and matching adjustment/session settings. Daily feeds and intraday feeds can differ; summing or scanning intraday bars is a separate calculation. This example does not promise that an exchange's daily bar includes every extended-hours print visible on another chart.

The chart's display time zone changes how timestamps are shown, not the script's requested daily context. See TradingView's time-zone explanation. A standard-chart guard avoids treating synthetic chart prices as ordinary traded OHLC; daily and higher chart intervals are rejected because this example is specifically an intraday overlay.

Confirmed daily values avoid the developing-current-day behavior. They can still change if the provider revises data or the symbol, session or adjustment context changes. Missing initial history stays undefined rather than becoming a zero price. Carry-forward mapping does not create missing trades or restore unavailable history.

A level is a reference, not a measured trading edge

A close above the prior high, a wick through it and a later move back below it are different events. Define the exact event, confirmation time and handling of repeated touches before counting them. The indicator itself classifies none of these events and contains no evidence that one market, chart interval or volume filter is more profitable.

Prior-day levels use two observed extrema. Pivot-point systems derive additional prices from selected formulas; they are not limited to five lines. VWAP uses price and volume over an anchor period and need not lie inside the prior day's range. It does not identify the average buyer's position. Combining these references is a research choice, not independent confirmation of a guaranteed outcome.

For a strategy adaptation, specify entry and exit timing, costs, gaps and order assumptions separately. A stop beyond a prior extreme can still fill at a worse price. No win rate, optimal stop distance or return is established by this example.

Pine Script v6: implementation and limits

Paste the complete example into Pine Editor on a standard intraday chart. Inspect the daily boundary and compare all four values with the preceding daily candle. The script intentionally rejects daily and higher chart intervals.

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("Previous confirmed daily high and low", overlay=true)

if not chart.is_standard or not timeframe.isintraday
    runtime.error("Use a standard intraday chart.")

[previousHigh, previousLow, previousClose, previousOpen] = request.security(syminfo.tickerid, "1D", [high[1], low[1], close[1], open[1]], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)

plot(previousHigh, "Previous daily high", color=color.blue, linewidth=2, style=plot.style_stepline)
plot(previousLow, "Previous daily low", color=color.orange, linewidth=2, style=plot.style_stepline)
plot(previousOpen, "Previous daily open", display=display.data_window)
plot(previousClose, "Previous daily close", display=display.data_window)

Specify a checkable adaptation in Pineify

Ask the Pine Script AI Coding Agent for a specific adaptation, such as a named session context or a confirmed first-cross alert. Require the daily offsets to stay inside the request, then compare output across a daily boundary and after reload. Generated code requires inspection and numerical testing.

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

No. Without the daily history offset, high is evaluated for the current requested daily bar. The example uses high[1] inside the request and lookahead_on to retrieve the preceding confirmed daily value.

Every requested value is shifted by one daily bar. The prior bar is already complete when the next daily period begins. Removing that offset would change the historical-information boundary.

The script inherits the symbol context and requests daily feed values. It does not explicitly force regular hours or aggregate a custom intraday session. Compare matching contexts before treating a difference as a code error.

No. Display time zone affects labels on the chart, not the requested daily series. Symbol and session settings can affect the data context.

No. It is an indicator with two visible step plots and two Data Window values. Alerts, order rules and performance testing are separate work.