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:
| Window | Reads |
|---|---|
| Session | A whole trading session, 18:00 to 17:00 on ES and NQ |
| RTH | Regular hours, 09:30 to 16:00 |
| Week, Month, Quarter | The sessions of that period |
| Opening range | The first N minutes of regular hours, or of the session |
| Time of day | Between two clock times, like 02:00 to 05:00 |
| This time of day | This 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
Outputs
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
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.