Indicators··7 min read

Prior Day Levels

0 references, link-verified · inline [n] markersEditor of record: Shane CantyStandards review editorial standard · audit log

A fundamental aspect of intraday trading analysis is understanding where the prior session closed and what its extreme prices were. The Prior Day Levels indicator plots the previous trading day's high, low, and close (settlement) as horizontal lines on the current chart, allowing traders to observe overnight gaps and context for current price action relative to yesterday's range.

This indicator is useful for day traders and swing traders who track overnight risk, identify support and resistance from the prior session, and spot gap reversals or continuations at market open.

//@version=6
indicator("Prior Day Levels", overlay=true)

// Inputs for customization
color_high = input.color(color.new(color.green, 80), "Prior Day High Color")
color_low = input.color(color.new(color.red, 80), "Prior Day Low Color")
color_close = input.color(color.new(color.blue, 80), "Prior Day Close Color")
line_width = input.int(2, "Line Width", minval=1, maxval=5)
line_style = input.string("Dashed", "Line Style", options=["Dashed", "Dotted", "Solid"])
show_values = input.bool(true, "Show Level Values")

// Convert line style input to plot style
style = line_style == "Dotted" ? plot.style_dotted : line_style == "Solid" ? plot.style_line : plot.style_dashed

// Get prior day OHLC values using daily timeframe
prior_high = request.security(syminfo.tickerid, "D", high[1])
prior_low = request.security(syminfo.tickerid, "D", low[1])
prior_close = request.security(syminfo.tickerid, "D", close[1])

// Plot the prior day levels
plot(prior_high, "Prior Day High", color=color_high, linewidth=line_width, style=style)
plot(prior_low, "Prior Day Low", color=color_low, linewidth=line_width, style=style)
plot(prior_close, "Prior Day Close (Settlement)", color=color_close, linewidth=line_width, style=style)

// Display table with values on last bar only
if show_values and barstate.islast
    var table tbl = table.new(position.top_right, 2, 3, border_color=color.gray, frame_color=color.gray)
    table.cell(tbl, 0, 0, "Prior High", bgcolor=color.new(color_high, 80))
    table.cell(tbl, 1, 0, str.format("{0, number, #.##}", prior_high))
    table.cell(tbl, 0, 1, "Prior Low", bgcolor=color.new(color_low, 80))
    table.cell(tbl, 1, 1, str.format("{0, number, #.##}", prior_low))
    table.cell(tbl, 0, 2, "Prior Close", bgcolor=color.new(color_close, 80))
    table.cell(tbl, 1, 2, str.format("{0, number, #.##}", prior_close))

How the code works

The indicator uses the request.security() function to fetch daily high, low, and close data regardless of the timeframe the trader is viewing. When called with the "D" parameter and the [1](#ref-1) offset, it retrieves the prior day's extreme prices and settlement level. The offset [1](#ref-1) means "one period back", which on a daily chart is the previous trading day.

Three plots render these levels as horizontal lines: green for the prior high, red for the prior low, and blue for the prior close. The choice to use different colors makes it straightforward to distinguish each level at a glance. Input parameters allow the trader to adjust colors, line width, and line style (dashed, dotted, or solid) to match the chart theme and personal preference.

A conditional block checks barstate.islast to ensure a table displaying the numeric values is drawn only once per chart, on the most recent bar. This prevents the table from redrawing on every bar, which would consume unnecessary resources. The var keyword on the table initialization means the table persists across bar updates rather than being recreated.

Reading it on a chart

When the indicator loads, three horizontal lines appear at yesterday's high, low, and closing price. If the market has gapped up at open, price will be above the prior close line, and traders often watch whether price pulls back to test the prior day's high or holds above it. A gap down below the prior close and low signals overnight weakness.

During the session, price oscillating between the prior day's high and low suggests a contained range, while breaks beyond these extremes may indicate expanding volatility or a directional trend. The prior close (settlement) line often acts as a neutral reference point: traders note whether price spends most time above or below it.

The numeric values table in the top right corner updates in real time and shows the exact price levels, eliminating the need to estimate from the chart axis. This is especially useful on instruments with fractional or micro-lot pricing where visual estimation introduces error.

The indicator can be applied to any timeframe: on a 5-minute chart, it shows context from the daily close and daily extremes; on a 1-hour chart, it provides the same reference. This versatility makes it applicable to both active day traders and position traders managing multi-day trades.

Limitations

No session awareness: The indicator assumes a single daily session per day and does not distinguish between time zones or extended hours trading. For equities traded in multiple markets or forex pairs spanning sessions across regions, the "prior day" boundary may not align with the trader's actual prior session. On forex charts, the definition of a trading day varies by broker and currency pair.

Settlement definition: For most equity and futures markets, settlement refers to the close price during regular trading hours. For some futures contracts or commodities, settlement is defined by an official settlement price computed after hours. The indicator uses only the candle's close, which may differ from the official settlement price published by the exchange. Traders working in these markets should verify the close definition against their exchange's settlement specification.

Gap-only snapshot: The indicator shows only the high and low from the prior day, not intraday structure. A market that rallied 3% at open then sold off 5% over the session will display only the day's extremes, obscuring the intraday reversal. Traders seeking finer granularity may need to also plot intraday support and resistance levels.

Repaint risk (none, but context matters): The indicator does not repaint because it references only historical data via the [1](#ref-1) offset. However, on lower timeframes during the last bar of the trading day, the prior close value does update as the session concludes, which could create visual confusion if a trader is watching the chart in real time.

Key definitions

High and Low: The highest and lowest price traded during a session or period; these represent the extreme boundaries of price action.

Settlement (Close): The official price at the end of a trading session; for equities, typically the last price traded during regular hours; for futures, sometimes an official settlement price computed after market close.

Request.security(): A Pine Script function that retrieves price data from a different timeframe or symbol than the current chart, enabling the script to pull daily data while viewing intraday bars.

Overnight gap: A discontinuity between the prior day's close and the current day's open, reflecting price movement in after-hours or overnight sessions when the primary market is closed.

Barstate.islast: A Pine Script function that returns true only on the most recent (rightmost) bar on the chart, used to execute code once rather than on every bar.

References

  1. TradingView, "Pine Script v6 Reference: request.security()", TradingView Docs. Https://www.tradingview.com/pine-script-reference/v6/#fun_request.security

  2. CME Group, "Equity Index Futures Specifications", CME Group Rulebook. Https://www.cmegroup.com/markets/index.html (specifications detail settlement procedures for various equity contracts)

  3. SEC, "Settlement and Custody of Securities", SEC Division of Market Regulation. Describes settlement periods and definitions for equities traded on national exchanges.

  4. TradingView, "Pine Script v6 Reference: plot()", TradingView Docs. Https://www.tradingview.com/pine-script-reference/v6/#fun_plot

  5. Investopedia, "Gap Definition and Trading Implications", Investopedia. Explains gap mechanics and how traders use prior-day reference levels to identify gap continuation and reversal.


Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard.

Last reviewed by the PropLedger research pipeline: 2026-09-13. Educational research on historical data, not financial advice.

Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard. Found an error? Email support@prop-ledger.org and the paper is corrected or withdrawn.