Concept 40 / 52·Levels·Prior period levels
‹ Pivot PointsRate of Change (ROC) ›

Previous Day High & Low in Pine Script

PDH · PDL · PDC · yesterday's high and low · prior day levels · previous day close

Yesterday's high, low and close drawn across today's chart: the most recent completed auction's extremes and settlement, which today's traders measure every move against.

Reads best on: Index futures, liquid stocks and major crypto pairs on 1-minute to 1-hour charts. On daily charts the levels read as short-term structure; choose the session boundary carefully on 24-hour markets.
On this page: the Pine v6 script, checked, drawn on real NVDA bars. Backtest it free, costs charged, every trade on the chart.
01

Definition

The previous day's high (PDH), low (PDL) and close (PDC) are the extremes and the final price of the last completed session, carried forward as horizontal lines on today's chart. They belong to the prior-period family of levels, which take the actual prices of a finished period rather than a formula. The high is where yesterday's buyers were finally turned back, the low is where the sellers were, and the close is the price the market settled on when the session ended.

The levels matter because they are the freshest memory the market has. Traders who were stopped out at yesterday's high, or who went short there, remember it; those who went long at the low defend it; and the close is the reference for every overnight position. Stops cluster just beyond the extremes, so a push through one either triggers a run as the stops fire, or fails and reverses once they are absorbed. Today's close against the previous close is also the day's simplest measure of progress.

The levels need no author and no settings, and they are the first thing many day traders mark before the open. The one real decision is what counts as the day: for stocks the regular session and the extended session give different highs and lows, and on 24-hour markets the boundary is wherever the data feed cuts the day. The implementation takes the previous completed daily bar, draws its high in green, its low in red and its close in amber, and marks a long on a close above the previous high and a short on a close below the previous low.

Expect the open to sit somewhere between the levels on an ordinary day, and outside them after a gap. A day that never leaves yesterday's range is an inside day, a sign of balance; a day that breaks one extreme and holds is a range extension. The first test of each level usually gets a reaction, and a break that is retested and holds from the other side is a clean role reversal. The lines step to new values at the first bar of each session and are flat for the rest of it.

02

Reading the chart

The levels are given; the work is reading how today's price treats them.

  1. Decide which session defines the day. For stocks choose regular hours or the full extended session and keep to it; for futures and crypto note where the data feed's daily bar starts.
  2. Mark the three lines before the open. The previous high, low and close are known at the first bar of the session and do not change during the day.
  3. Locate the open against them. An open inside the range is balance; an open above the previous high or below the previous low is a gap, and the levels become the fill targets.
  4. Read the first test. A wick through the level with a close back inside is a sweep; a close beyond it and a retest that holds from the other side is a break.
  5. Watch the close relative to the previous close. Holding above it keeps the day positive; losing it after a strong open is a warning that the early move failed.
  6. Add context. A previous day high that coincides with a pivot, a round number or the developing VWAP is a stronger zone than one in empty space.
03

The maths

There is no formula beyond taking the previous completed daily bar's high, low and close and holding them through the current day.

PDHt=Hd−1\mathrm{PDH}_t = H_{d-1}
PDLt=Ld−1\mathrm{PDL}_t = L_{d-1}
PDCt=Cd−1\mathrm{PDC}_t = C_{d-1}
Ranged−1=Hd−1−Ld−1\mathrm{Range}_{d-1} = H_{d-1} - L_{d-1}
PDHt\mathrm{PDH}_tthe previous day high shown on the current bar
PDLt\mathrm{PDL}_tthe previous day low shown on the current bar
PDCt\mathrm{PDC}_tthe previous day close shown on the current bar
Hd−1,Ld−1,Cd−1H_{d-1}, L_{d-1}, C_{d-1}high, low and close of the previous completed day
d−1d-1the previous completed day as the chart's daily bar defines it
Ranged−1\mathrm{Range}_{d-1}the previous day's range, a guide to how far today's levels are from each other

The implementation requests the previous day's bar from the daily timeframe with lookahead switched off, so the levels appear at the first bar of the new day and never repaint.

The lines are drawn on intraday and daily charts only. On a weekly chart the daily request returns a slice that does not line up with the bars, so the script leaves the levels blank there.

For stocks the daily bar may or may not include extended hours, depending on the chart's session setting; the levels follow whatever the daily bar contains.

The same idea extends to the previous week and month; those levels are wider apart and hold for the whole period.

04

Inputs that matter

InputTypicalWhat changing it does
Sessionthe exchange dayRegular-hours levels for stocks exclude the overnight extremes; extended-hours levels include them. The traders you trade against usually watch the regular session.
Periodprevious dayThe previous week's or month's high and low give swing traders the same read on a larger scale, with the levels holding for the whole period.
Break ruleclose beyond the levelSignalling on a wick beyond the level catches sweeps and fakes; waiting for a close beyond it, as the script does, trades fewer breaks but cleaner ones.
05

In practice

  • As breakout levels: a close above the previous day's high with volume behind it is a range extension, and the script marks it long; a close below the previous low is the mirror short.
  • As a sweep-and-reverse setup: a wick through the previous low that closes back inside the range shows stops were taken and absorbed, and a long against that low aims at the previous close.
  • As gap targets: after a gap up, the previous close and then the previous high are the fill levels; after a gap down, the previous close and the previous low.
  • As an inside-day filter: while price holds between the previous high and low the day is balanced, and range tactics apply until one level breaks.
  • As confluence: a previous day level that coincides with a pivot, a round number or the developing VWAP is a stronger zone and the one that carries weight.
  • As a swing-trade reference: on daily charts the previous day's high and low mark short-term structure, and a run of closes above each day's previous high is a strong trend.
06

Where it goes wrong

  • Using the wrong session. An overnight spike that is not part of the regular session gives a different high; pick the session other traders watch and stay consistent.
  • Chasing the first tick through a level. Stops fire on the break and the move often reverses; wait for a close beyond and a retest, or trade the failure.
  • Treating the close as unimportant. The previous close is the reference for every overnight position and a gap-fill target; it deserves the same attention as the extremes.
  • Ignoring the size of yesterday's range. After a very wide day the levels are far away and today rarely reaches them; after a narrow day they are close and break easily.
07

Compared with

Pivot Points. Pivots are computed from yesterday's high, low and close by a formula and produce seven new prices; the previous day levels are those three inputs themselves. The pivot set is a projection, the previous day levels are the raw memory.

Opening Range Breakout. The opening range is the high and low of today's first minutes; the previous day levels come from the whole of yesterday. An opening range that forms inside yesterday's range gives two sets of levels, and the larger set frames the smaller.

Donchian Channels. A Donchian channel is the highest high and lowest low over N bars and moves as the window rolls; the previous day's high and low are a one-period channel fixed for the whole day. The channel generalises the idea, the daily levels keep it specific.

Support & Resistance. Hand-drawn support and resistance come from swing points that can be weeks old and need judgement to place; the previous day levels are objective, always fresh and known before the open, which is why they make good first references.

08

Build it in Quant

Type one of these in the Quant desk, or click it. A request that fits a checked template is assembled on the spot without a credit; anything beyond the blanks goes to the copilot, which edits on top of the checked script.

Open Previous Day High & Low on the workbench chart
Drawn on real data; then audit, backtest and refine in conversation.
Open in Quant →
09

Questions

  • Why do the previous day's high and low matter?

    Because they are the most recent places where the market rejected higher and lower prices, and every trader who was involved remembers them. Stops sit just beyond them, overnight positions are measured against the close, and the open is judged by where it sits in that range. They are the freshest reference the market has.

  • Should I use regular-hours or extended-hours levels?

    Use the session that the traders you compete with are watching. For most stocks that is the regular session, because the overnight extremes are made on thin volume. For index futures, many traders use the regular-hours high and low even though the contract trades overnight. Whichever you choose, keep it consistent.

  • What is an inside day?

    A day whose whole range sits inside the previous day's range: today's high is below yesterday's high and today's low is above yesterday's low. It shows balance and shrinking volatility, and the break of either boundary the next day is watched as a range expansion signal.

  • How is a break of the previous day high read?

    A break rule waits for a close above it on an intraday bar, ideally on above-average volume, then for a retest that holds from above. The previous high becomes the stop reference and the next level, a pivot or the previous week's high, is the target. If price closes back below it within a few bars, the break failed.

  • Does this work on crypto?

    Yes, once you settle what the day is. Crypto trades continuously, so the daily bar starts wherever the data feed cuts it, often midnight UTC. The levels only carry weight if many traders use the same boundary, so pick the common one and check that the lines step where you expect.

  • Do the lines repaint?

    No. The levels come from the previous completed day, requested without lookahead, so they are fixed at the first bar of the session and stay fixed until the next one. That also means a backtest sees exactly the levels a trader saw at the time.