OPEN-SOURCE SCRIPT
Cập nhật Grid Ranges+ (M1D)

Grid Ranges+ (M1D)
A grid-range framework for the New York trading day. It draws the higher-timeframe levels that frame the current range, divides any range you choose into quadrants, octants or sixteenths, boxes the three trading sessions, and reads the 12AM–2AM algorithmic range for aid in a directional bias.
Every session window is evaluated in America/New York regardless of the time zone the chart is viewed from, and every window is an input.
HOW IT IS BUILT
Levels are anchored to the candle that formed them. A higher-timeframe data request returns the value of a period's high but not the bar that made it. This script tracks each period's extremes on the chart instead, along with the bar time of each, so a previous-day high begins at the candle that set it rather than at the moment the number changed. The trade-off is that a period only reports once its opening bar is inside loaded history; where it is not, the level stays hidden rather than anchoring to a bar that did not set it.
Week and month boundaries derive from the New York day stamp, not from a weekly timeframe change, which is unreliable on futures instruments.
The swing pair is kept alternating. Pivot-high and pivot-low detection are independent of each other, so a chart can print several highs with no qualifying low between them. A pivot on the same side as the stored one replaces it only when it is more extreme, while a pivot on the opposite side begins the next leg. Without that rule, a recent high pairs with a low from a different move and the two do not describe one leg.
WHAT IT DRAWS
Levels.
Previous month, previous week, previous day and three-day highs and lows, the previous day's equilibrium, and the midnight open. Each line runs from its origin candle to a fixed right-hand edge and carries its name at that end, on the same eye-line as the price it names. Names that would otherwise print on top of each other move right into a second column rather than off their own line.
The grid.
A range bounded by any two of those levels, selected from two dropdowns and oriented automatically, divided into quadrants, octants or sixteenths. It begins at the earlier of the two origin candles. The midline is labelled EQ, and quarter fractions are reduced to lowest terms. A fraction is suppressed wherever a level already names that price, so no price carries two names.
Sessions.
Asia, London and New York as boxes that grow with each session's own high and low and freeze when the window closes. The caption sits below the box at the session open. Each session carries its own day mask.
The bias.
The 12AM–2AM algorithmic range as a box, and a console reading BULLISH, BEARISH, INVALIDATED or UNSET. A sweep clearing both the range boundary and the midnight open inside the sweep window, followed by a confirmed close back inside the range, arms a directional read. A confirmed close back through the swept extreme invalidates it, after which the opposite side may arm. Three alert conditions cover those transitions.
SETTINGS
Grouped as-
Time windows, Sessions, Bias engine, Grid range, Levels shown, Level styling and Labels.
Every level carries its own colour, line style, line width and label offset. The grid carries its own colour, style, width, interior transparency and equilibrium colour. Every session window is an input with a New York default and its own day mask, and session boxes carry their own colours and fill transparency.
NOTES
Nothing extends to the right edge of the chart. Every line stops a set number of bars past the live candle, and its label sits at that end.
Current-day and swing anchors move as the session develops, so a grid anchored to them redraws live. A grid anchored to completed periods does not.
Display toggles gate drawing only. Hiding an element never stops it being tracked, so the bias read is unaffected by what is on screen.
Grid boundaries are not drawn by the grid by default. A boundary is the anchor level itself, which already draws its own line from its own origin candle.
Disclaimer-
This script is a charting tool. It is not financial advice, and it makes no claim about where price will go.
A grid-range framework for the New York trading day. It draws the higher-timeframe levels that frame the current range, divides any range you choose into quadrants, octants or sixteenths, boxes the three trading sessions, and reads the 12AM–2AM algorithmic range for aid in a directional bias.
Every session window is evaluated in America/New York regardless of the time zone the chart is viewed from, and every window is an input.
HOW IT IS BUILT
Levels are anchored to the candle that formed them. A higher-timeframe data request returns the value of a period's high but not the bar that made it. This script tracks each period's extremes on the chart instead, along with the bar time of each, so a previous-day high begins at the candle that set it rather than at the moment the number changed. The trade-off is that a period only reports once its opening bar is inside loaded history; where it is not, the level stays hidden rather than anchoring to a bar that did not set it.
Week and month boundaries derive from the New York day stamp, not from a weekly timeframe change, which is unreliable on futures instruments.
The swing pair is kept alternating. Pivot-high and pivot-low detection are independent of each other, so a chart can print several highs with no qualifying low between them. A pivot on the same side as the stored one replaces it only when it is more extreme, while a pivot on the opposite side begins the next leg. Without that rule, a recent high pairs with a low from a different move and the two do not describe one leg.
WHAT IT DRAWS
Levels.
Previous month, previous week, previous day and three-day highs and lows, the previous day's equilibrium, and the midnight open. Each line runs from its origin candle to a fixed right-hand edge and carries its name at that end, on the same eye-line as the price it names. Names that would otherwise print on top of each other move right into a second column rather than off their own line.
The grid.
A range bounded by any two of those levels, selected from two dropdowns and oriented automatically, divided into quadrants, octants or sixteenths. It begins at the earlier of the two origin candles. The midline is labelled EQ, and quarter fractions are reduced to lowest terms. A fraction is suppressed wherever a level already names that price, so no price carries two names.
Sessions.
Asia, London and New York as boxes that grow with each session's own high and low and freeze when the window closes. The caption sits below the box at the session open. Each session carries its own day mask.
The bias.
The 12AM–2AM algorithmic range as a box, and a console reading BULLISH, BEARISH, INVALIDATED or UNSET. A sweep clearing both the range boundary and the midnight open inside the sweep window, followed by a confirmed close back inside the range, arms a directional read. A confirmed close back through the swept extreme invalidates it, after which the opposite side may arm. Three alert conditions cover those transitions.
SETTINGS
Grouped as-
Time windows, Sessions, Bias engine, Grid range, Levels shown, Level styling and Labels.
Every level carries its own colour, line style, line width and label offset. The grid carries its own colour, style, width, interior transparency and equilibrium colour. Every session window is an input with a New York default and its own day mask, and session boxes carry their own colours and fill transparency.
NOTES
Nothing extends to the right edge of the chart. Every line stops a set number of bars past the live candle, and its label sits at that end.
Current-day and swing anchors move as the session develops, so a grid anchored to them redraws live. A grid anchored to completed periods does not.
Display toggles gate drawing only. Hiding an element never stops it being tracked, so the bias read is unaffected by what is on screen.
Grid boundaries are not drawn by the grid by default. A boundary is the anchor level itself, which already draws its own line from its own origin candle.
Disclaimer-
This script is a charting tool. It is not financial advice, and it makes no claim about where price will go.
Phát hành các Ghi chú
Update — liquidity pools, NY Lunch range, full New York sessionNEW
· Relative equal highs and lows are now detected and drawn. Two swing pivots resting within a tick tolerance of each other are treated as one liquidity pool, marked $$ — or BSL / SSL if you prefer that notation. The pool is anchored at the candle that actually made its price, and only forms if that price was never traded through between its two pivots, so a drawn pool is liquidity that is still sitting there. Tolerance is set in ticks, so it scales across instruments without adjustment.
· A raided pool turns dotted and stops at the candle that took it instead of disappearing. Solid and running to the right edge means live; dotted and ending mid-chart shows both that it was taken and where. A wick counts as the sweep — no close through is required, and the line ends the moment the wick prints. Two spent pools are kept by default; that is adjustable, and setting it to zero clears them on impact.
· NY Lunch high and low. The 12:00–13:00 range is tracked and frozen when the window closes, so what carries into the afternoon is the completed range rather than a moving one. It retires at midnight rather than lingering into the following day. Off by default.
IMPROVEMENTS
· The New York session box now spans the full cash session, 09:30 to 16:00, so it covers lunch instead of stopping before it. It previously ran 07:00 to 10:00, which is a kill zone rather than a session. Asia and London are unchanged, and every session window remains an input with its own day mask.
Phát hành các Ghi chú
Lines and text that were meant to be black were drawing in a dark grey. They are now black.- The grid lines, the REH / REL liquidity lines and the midnight open — and every label that goes with them — now draw in true black. Their colour defaults resolved to a dark slate grey, which on a light chart read as washed out beside the blue and red level lines rather than as the neutral ink those levels are meant to carry.
- The 12AM–2AM range box takes the same correction, on both its border and its fill.
- The bias console takes it too, on its frame and on its text.
Nothing changes in how levels, liquidity or the bias are found, where anything is drawn, or when the alerts fire. This is colour only.
Existing charts keep their saved settings. The range box and the console correct themselves; the grid, liquidity and midnight open colours are inputs, so reset the indicator to defaults to pick those up — or set those three colour pickers to black by hand if you would rather keep your other settings.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.