OPEN-SOURCE SCRIPT
已更新 Previous Day / Week / Month Range Levels

Draws the high, low and internal subdivisions of the last completed period on up to three higher timeframes at once.
Why the prior range matters
A finished period leaves behind a structure the market keeps referring back to. Yesterday's high and low are where yesterday's argument was settled, and price spends a surprising amount of the next session negotiating with those two numbers — breaking them, failing at them, or holding between them.
The subdivisions add resolution to that. The midpoint separates the upper and lower half of the range, and which side price accepts on tells you who won the period. The quarters mark the shallow zones inside each half — the levels a pullback reaches before it has retraced anything meaningful.
What it draws
Prior period high and low, as solid boundary lines
Midpoint at 50%
Quarters at 25% and 75%
Optional eighths at 12.5% and 87.5% for wider ranges
Price labels on every level, with the timeframe named
Three timeframe slots, each with its own colour and on/off switch. Defaults are Daily and Weekly enabled, Monthly available. Any timeframe works — 4H, quarterly, yearly — so intraday traders and swing traders can both configure it sensibly.
The levels do not repaint
Each level is read from the previous completed bar of its timeframe using a lookahead-safe request. Once a period closes, its levels are fixed and will not move. Nothing is recalculated on the developing bar, and nothing you see on historical bars was drawn with information from the future.
That means the numbers are frozen for the whole current period. The daily levels you see at the open are the same ones at the close.
Notes on use
Session settings matter. On a chart set to regular hours, the daily range is built from regular-hours prices only — switch to extended hours and every level moves. Neither is wrong, but be deliberate about which one you're reading.
Multi-period timeframes such as 2W or 6M are grouped by TradingView from a fixed reference point, which may not align with where you'd assume a fortnight begins. Worth eyeballing directly before relying on them.
Drawings are anchored by timestamp rather than bar index, so they stay put when you scroll back and TradingView loads more history. Bar indices renumber every time more history loads; timestamps do not.
There is also a fully transparent plot of close in there, doing a job that is easy to miss. Lines and labels do not feed TradingView's autoscale, so a script that only draws has no price range of its own and can be handed a separate price scale — at which point every level sits at an offset from the candles. The transparent plot gives the script a real range and locks it to the symbol's.
Settings
Three timeframe slots, each with an enable toggle, a timeframe and a colour
Midpoint, quarters and eighths switched independently
Price labels on or off, with a size option
Boundary line width, and a separate transparency for the inner levels so the range edges stay dominant
Extend left and extend right, in bars
Open source. Read it, fork it, adapt it. The non-repainting request pattern, the time-anchored drawing and the scale anchor are all worth stealing for your own scripts.
For educational purposes only. Nothing here is financial advice, a recommendation, or a solicitation to trade. Levels are reference points, not signals.
Why the prior range matters
A finished period leaves behind a structure the market keeps referring back to. Yesterday's high and low are where yesterday's argument was settled, and price spends a surprising amount of the next session negotiating with those two numbers — breaking them, failing at them, or holding between them.
The subdivisions add resolution to that. The midpoint separates the upper and lower half of the range, and which side price accepts on tells you who won the period. The quarters mark the shallow zones inside each half — the levels a pullback reaches before it has retraced anything meaningful.
What it draws
Prior period high and low, as solid boundary lines
Midpoint at 50%
Quarters at 25% and 75%
Optional eighths at 12.5% and 87.5% for wider ranges
Price labels on every level, with the timeframe named
Three timeframe slots, each with its own colour and on/off switch. Defaults are Daily and Weekly enabled, Monthly available. Any timeframe works — 4H, quarterly, yearly — so intraday traders and swing traders can both configure it sensibly.
The levels do not repaint
Each level is read from the previous completed bar of its timeframe using a lookahead-safe request. Once a period closes, its levels are fixed and will not move. Nothing is recalculated on the developing bar, and nothing you see on historical bars was drawn with information from the future.
That means the numbers are frozen for the whole current period. The daily levels you see at the open are the same ones at the close.
Notes on use
Session settings matter. On a chart set to regular hours, the daily range is built from regular-hours prices only — switch to extended hours and every level moves. Neither is wrong, but be deliberate about which one you're reading.
Multi-period timeframes such as 2W or 6M are grouped by TradingView from a fixed reference point, which may not align with where you'd assume a fortnight begins. Worth eyeballing directly before relying on them.
Drawings are anchored by timestamp rather than bar index, so they stay put when you scroll back and TradingView loads more history. Bar indices renumber every time more history loads; timestamps do not.
There is also a fully transparent plot of close in there, doing a job that is easy to miss. Lines and labels do not feed TradingView's autoscale, so a script that only draws has no price range of its own and can be handed a separate price scale — at which point every level sits at an offset from the candles. The transparent plot gives the script a real range and locks it to the symbol's.
Settings
Three timeframe slots, each with an enable toggle, a timeframe and a colour
Midpoint, quarters and eighths switched independently
Price labels on or off, with a size option
Boundary line width, and a separate transparency for the inner levels so the range edges stay dominant
Extend left and extend right, in bars
Open source. Read it, fork it, adapt it. The non-repainting request pattern, the time-anchored drawing and the scale anchor are all worth stealing for your own scripts.
For educational purposes only. Nothing here is financial advice, a recommendation, or a solicitation to trade. Levels are reference points, not signals.
版本注释
Adds a wording option for the price labels.Labels can now spell the timeframe out — Previous Day High, Previous Week Low,
Previous Month 50% — instead of the short codes D High, W Low, M 50%. The
setting is "Label wording", under Style.
Short stays the default, so existing charts look exactly as they did. Short
keeps things readable when several timeframes are on at once. Descriptive suits
a single timeframe, screenshots, and anyone still getting familiar with the
levels.
The levels, the maths and the non-repainting behaviour are unchanged.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。