Price History Node

The Price History node reads a level from bars that have already closed: the 20-bar high, yesterday's low, the opening range, the average daily range. Its windows, why it never includes the forming bar, and the mistakes it saves you from.

NodeBy AlgoLiftUpdated 7 min read
On this page 10How it worksCompleted bars, alwaysCalendar windowsAcross the last N periodsExample: buy the break of the 20-bar highSettingsOutputsUse something else whenWhen it doesn't behaveGoing further

Breakouts, pullbacks and gap trades all start from a level: the 20-bar high, yesterday's low, the top of the first 30 minutes. The Price History node is where those levels come from. Pick a statistic, a field and a window, and it reads the level from bars that have already closed, so the bar you're trading is never part of it.

Takes
Nothing. It reads the bars of its series
Gives
A level, plus how many bars ago it printed
Reach for it
A rule needs a high, low, average or total from finished bars, sessions or weeks

How it works

The node reads like a sentence, because it is one: the highest high of the last 20 completed bars. Switch to Lowest and Low and you have the 20-bar low. Set the length to 1 and it's the previous bar's high, low or close. Total only works on volume and range, since adding up prices means nothing.

Bars since it printed says how many bars ago the extreme happened (0 is the last completed bar). On a tie the older bar counts, so a retest of the high doesn't reset it.

Completed bars, always

The window ends at the last completed bar. The bar that's still forming is never in it, and that one rule removes a whole family of bugs.

Take "price breaks the 20-bar high". If the window held the bar being traded, the high would rise with price and price could never get above it. Because the window stops at the last close, live price can cross it, and a Crossover with Current Price on a and the level on b, on the Intrabar clock, catches the moment.

It's also why Price History replaced the old recipe of Current Price into a Rolling Min/Max Modifier into a Bars Ago Modifier. That chain looked like a 20-bar high and wasn't one: Current Price is the live trade price, so it tracked the highest close, and the Bars Ago made it a bar late. Keep those modifiers for indicator values.

Otherwise Skip is for levels that should sit further back, like the average volume of the 20 bars before the last one. Against live price it only makes the level a bar older, and the node says so.

Calendar windows

Bars are one kind of window. The Window menu also reads the exchange calendar, in New York time:

WindowReads
SessionA whole trading session, 18:00 to 17:00 on ES and NQ
RTHRegular hours, 09:30 to 16:00
Week, Month, QuarterThe sessions of that period
Opening rangeThe first N minutes of regular hours, or of the session
Time of dayBetween two clock times, like 02:00 to 05:00
This time of dayThis bar's own clock slot, across the sessions before it

Session, RTH, week, month and quarter come in two phases. Prior is the last finished period, so yesterday's high is Session, Prior, High. So far is the one in progress. On Prior, Skip counts whole periods back. A time-of-day window has the same pair, called Completed and In progress.

On a calendar window the field is the reading, so there's no statistic: a session's high is its high. Periods add fields bars don't have: the midpoint, the opening gap (the open minus the prior period's close), whether it filled, and Move against the close and Move with the close, which measure how far the period ran from its open against the way it finished, and with it.

A finished period is read one bar after it closes, from this series' own bars. An opening range is empty until it has closed, then holds steady until its regular hours (or session) are over.

Across the last N periods

Across turns one reading into a statistic over many: the range, Average across the last 10 sessions, is the average daily range. It runs over finished periods only and is never partial, staying empty until all N are on record. That's not the same as averaging bars, which on 5-minute bars gives you the size of a typical 5-minute bar.

This time of day is always a list. It reads the bar's own slot, say 10:35 to 10:40 on 5-minute bars, across the last N sessions that traded it (a half day that never reached the slot is left out, not counted as zero). Its average volume is the honest yardstick for relative volume, because it never mixes the open's volume with lunch's.

Example: buy the break of the 20-bar high

You trade ES 15m and want a plain breakout: buy the moment price takes out the high of the last 20 bars, with the stop at the low of those same bars.

Add a Price History. It arrives as the 20-bar high (Highest, High, 20 bars, Skip 0). Wire Current Price into a of a Crossover and the Price History's Level into b, set the direction to Above and the clock to Intrabar, and send the Crossover to a long Entry. Then add a second Price History set to Lowest and Low, set the Bracket Order's stop to measure from a Level, and wire the 20-bar low into its level input with a distance of 0. The stop lands on the 20-bar low as it stood when the trade filled.

Rather wait for a 15-minute close above the high? Switch the Crossover to Bar close and the level's Skip to 1, for the reason in the callout.

Settings

Window
Default Bars
Bars, Session, RTH, Week, Month, Quarter, Opening range, Time of day or This time of day.
Statistic
Default Highest
Highest, Lowest, Average or Total, on a bar window.
Field
Default High
Open, High, Low, Close, Volume or Range. Calendar windows add Midpoint, Gap, Gap filled and the moves from the open.
Length
Default 20
Completed bars in a bar window, 1 to 500.
Skip
Default 0
Completed bars left out before the window, 0 to 500. On a Prior period it's whole periods back, 0 to 20.
Prior or So far
Default Prior
The last finished period, or the one in progress. Completed or In progress on a time-of-day window.
Opening range minutes
Default 30
How long the opening range lasts, 1 to 390.
Opens with
Default Regular hours
Regular hours (09:30), or the session (18:00 on futures).
Window start
Default 02:00
Where a time-of-day window starts, New York time.
Window end
Default 05:00
Where it ends. It can cross midnight, so 18:00 to 09:30 is the overnight session.
Across
Default Just this one
Or Highest, Lowest, Average or Total across the last N finished periods.
Periods
Default 10
How many periods Across reads, 2 to 100.
At least
Default 5
This time of day only: how many of those sessions must have traded the slot.
Series
Default Primary series
Whose bars it reads. Pick a slower series for, say, the 20-bar high of the hourly chart.

Outputs

Level
Number
The reading: a price, or a volume, range or move in points, depending on the field.
Bars since it printed
Number
Bars back to the bar that made the extreme. Highest and Lowest on a bar window only.

Calendar windows add two counters for the period in progress, Bars in period and Minutes in period, so a rule about the first few bars of a session is one Comparison.

Use something else when

You want the moment price breaks the level
Price History supplies the level. A Crossover with Current Price on a and the level on b, on the Intrabar clock, fires on the break itself.
The highest or lowest of an indicator
Price History reads price and volume. For the highest RSI of 20 bars, put a Rolling Min/Max on the RSI.
Yesterday's pivot points
Classic, Camarilla and Woodie pivots are one node. Don't rebuild the formulas from Price History and Math.
Ratio levels inside a range
Wire two Price History levels into it, like yesterday's high and low, for the 61.8% level or where price sits between them.

When it doesn't behave

“Closed above the 20-bar high” never fires

The window includes the bar you're testing, and no bar closes above its own high. The node shows the problem in red with a button, End the window one bar earlier. Press it and the rule asks the question you meant: did the last close beat the 20 bars before it?

The level is empty for part of the day

Some windows only exist some of the time. An opening range is empty until it has closed, an In progress time-of-day window is empty outside its hours, and a list waits for all its periods. A comparison against an empty level reads false, so the rule waits instead of guessing.

My average daily range is only a few points

You averaged bars, not days. Window Bars with Field Range and Average gives the size of a typical bar. For the daily number, use Window Session, Prior, Field Range, then Average across the last 10 sessions. Type "Average daily range" into the node palette's search and it drops in ready-made.

The builder won't take RTH on my 1-hour bars

A calendar window needs bars that close on its edges: time bars of an hour or less that divide the hour. No 60-minute bar closes at 09:30, so regular hours can't be read from them. Use 30-minute bars or finer, or move a time-of-day edge to a time a bar closes on.

Going further

Length, Skip, Periods, the opening range's minutes and a time-of-day window's edges can all be swept. The field, the statistic and the window kind can't, on purpose: changing them changes the idea, not its tuning. Even so, a 10-bar against a 50-bar breakout is a search, and every configuration counts against the project's search budget.

With a bar window, hover a bar on the results chart and it shades the window that bar's level came from, with a tick on the bar where the extreme printed. It's the fastest way to check the node reads what you think it does.

Or ask the copilot