DNSE VN301!, SMA ADX/DI Trend Following Strategy"SMA ADX DI Trend Following" is a trend-following strategy designed to identify and capture directional price movements by combining SMA slope analysis with ADX trend-strength confirmation and DI directional signals. The strategy uses SMA(89) to determine the primary trend direction, while ADX(14) confirms that the market has sufficient trend strength and DI identifies whether bullish or bearish pressure is dominant.
By requiring agreement between trend direction, trend strength, and directional momentum, the strategy seeks to filter out weak or unclear market conditions while participating in stronger intraday trends. An optional SMA(200) trend filter provides additional broader-trend confirmation. The strategy also includes configurable stop loss, take profit, trading session filters, signal confirmation settings, and automatic end-of-session position closure for disciplined risk management.
Strategy settings and configuration:
Chart timeframe: recommended 15-minute chart
Position size: 3 contracts
Signal SMA length: 89
SMA slope lookback: 5
ADX length: 14
ADX threshold: 20
DI filter: On / Off
New signal only: On / Off
SMA trend filter: disabled by default
Trend filter SMA length: 200
Stop loss: 10 points
Take profit: 20 points
Take profit: On / Off
Time filter: On / Off
Trading session: 09:00 – 14:30
Trade direction: Long / Short / Both
Signal arrows: disabled by default
Default script settings:
The strategy uses a signal SMA with a length of 89 to identify the main market direction. Instead of comparing the current SMA with only the previous candle, the bot uses a slope lookback of 5.
This means the bot compares the current SMA with the SMA value from 5 candles ago. If the current SMA is higher than the SMA from 5 candles ago, the SMA is considered rising. If the current SMA is lower than the SMA from 5 candles ago, the SMA is considered falling.
This method helps reduce noise on the 1-minute timeframe. The bot does not enter a trade just because the SMA moves slightly within one candle.
ADX(14) is used to confirm trend strength. When ADX is above 20, the market is considered to have enough trend strength for trading signals to be considered.
DI is used to confirm trend direction. When +DI is above -DI, buying pressure is dominant. When -DI is above +DI, selling pressure is dominant.
When the DI filter is enabled, the bot only allows Long trades when +DI > -DI. It only allows Short trades when -DI > +DI.
The “New signal only” option helps reduce repeated entries in the same signal state. When this option is enabled, the bot only enters when a new Long or Short state appears.
The SMA(200) trend filter is disabled by default. Users can enable this filter if they want stricter alignment with the larger trend.
When the SMA(200) trend filter is enabled, the script only allows Long trades when SMA(200) is rising and only allows Short trades when SMA(200) is falling.
Entry and exit rules:
Long entry:
Signal SMA is rising based on the 5-candle lookback
AND ADX(14) > 20
AND +DI > -DI, if the DI filter is enabled
AND SMA(200) is rising, if the SMA trend filter is enabled
AND a new Long state has just appeared, if new signal only mode is enabled
AND the signal appears during the trading session
AND trade direction allows Long entries
Long exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Signal SMA turns downward
Reversal when a valid Short signal appears
Automatic position close at the end of the trading session
Short entry:
Signal SMA is falling based on the 5-candle lookback
AND ADX(14) > 20
AND -DI > +DI, if the DI filter is enabled
AND SMA(200) is falling, if the SMA trend filter is enabled
AND a new Short state has just appeared, if new signal only mode is enabled
AND the signal appears during the trading session
AND trade direction allows Short entries
Short exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Signal SMA turns upward
Reversal when a valid Long signal appears
Automatic position close at the end of the trading session
Strategy logic:
CNPS 05 is suitable for market phases with clear trend direction. The signal SMA identifies the main direction. ADX filters for markets with enough trend strength. DI confirms whether buying or selling pressure is dominant.
This structure helps reduce noise in sideways conditions. The bot does not rely only on SMA slope. It also requires enough trend strength and directional confirmation from DI.
Time filter:
The default trading session is 09:00 – 14:30, designed to avoid two abnormal volatility periods.
ATO 08:45 – 09:00 is the opening auction period. Price can gap strongly and technical signals may be noisy.
ATC and negotiated trading 14:30 – 15:00 is the closing auction period. Price can move sharply or reverse quickly.
Users can adjust the start time and end time in the bot settings.
Risk disclaimer:
Futures trading involves a high level of risk and prices can move sharply. This script is provided for reference, research, and backtesting purposes only. Users should fully understand derivatives trading, their own risk tolerance, and the strategy logic before applying it to live trading.
All investment decisions are the responsibility of the user. phaisinh.online is not responsible for any losses arising from the use of this strategy in real trading. Past performance does not guarantee future results.
______________________________________________________________
"SMA ADX DI Trend Following" là một chiến lược giao dịch theo xu hướng, được thiết kế nhằm xác định và nắm bắt các chuyển động giá theo xu hướng bằng cách kết hợp phân tích độ dốc SMA với xác nhận sức mạnh xu hướng từ ADX và tín hiệu định hướng từ DI. Chiến lược sử dụng SMA(89) để xác định hướng xu hướng chính, trong khi ADX(14) xác nhận thị trường đang có đủ sức mạnh xu hướng và DI xác định bên mua hay bên bán đang chiếm ưu thế.
Bằng cách yêu cầu sự đồng thuận giữa hướng xu hướng, sức mạnh xu hướng và động lượng định hướng, chiến lược hướng tới việc lọc các điều kiện thị trường yếu hoặc không rõ xu hướng, đồng thời tham gia vào các xu hướng intraday mạnh hơn. Bộ lọc xu hướng SMA(200) tùy chọn cung cấp thêm xác nhận về xu hướng tổng thể. Chiến lược cũng bao gồm các tùy chọn Stop Loss, Take Profit, bộ lọc khung thời gian giao dịch, cài đặt xác nhận tín hiệu và cơ chế tự động đóng vị thế khi kết thúc phiên, nhằm đảm bảo quản trị rủi ro một cách chặt chẽ và có kỷ luật.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 15 phút
Khối lượng giao dịch: 3 hợp đồng
Chu kỳ SMA tín hiệu: 89
SMA slope lookback: 5
Chu kỳ ADX: 14
Ngưỡng ADX: 20
Bộ lọc DI: Bật / Tắt
Chỉ vào khi tín hiệu mới: Bật / Tắt
Bộ lọc xu hướng SMA: Tắt mặc định
Chu kỳ SMA bộ lọc: 200
Cắt lỗ: 10 điểm
Chốt lời: 20 điểm
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Hiện mũi tên tín hiệu: Tắt mặc định
Cài đặt mặc định của script:
Chiến lược sử dụng SMA tín hiệu chu kỳ 89 để xác định hướng chính của thị trường. Thay vì so sánh SMA hiện tại với đúng một nến trước, bot sử dụng SMA slope lookback 5.
Điều này có nghĩa là bot so sánh SMA hiện tại với SMA của 5 nến trước. Nếu SMA hiện tại cao hơn SMA của 5 nến trước, SMA được xem là đang dốc lên. Nếu SMA hiện tại thấp hơn SMA của 5 nến trước, SMA được xem là đang dốc xuống.
Cách tính này giúp giảm nhiễu trên khung 1 phút. Bot không vào lệnh chỉ vì SMA nhích nhẹ trong một nến ngắn.
ADX(14) được dùng để xác nhận sức mạnh xu hướng. Khi ADX lớn hơn 20, thị trường được xem là có đủ lực xu hướng để xét tín hiệu giao dịch.
DI được dùng để xác nhận hướng xu hướng. Khi +DI lớn hơn -DI, lực tăng đang chiếm ưu thế. Khi -DI lớn hơn +DI, lực giảm đang chiếm ưu thế.
Khi bật bộ lọc DI, bot chỉ cho phép lệnh Mua khi +DI > -DI. Bot chỉ cho phép lệnh Bán khi -DI > +DI.
Tùy chọn “Chỉ vào khi tín hiệu mới” giúp hạn chế vào lại liên tục trong cùng một trạng thái. Khi bật tùy chọn này, bot chỉ vào lệnh khi trạng thái Long hoặc Short vừa mới xuất hiện.
Bộ lọc SMA(200) được để tắt mặc định. Người dùng có thể bật bộ lọc này nếu muốn giao dịch chặt hơn theo xu hướng lớn.
Khi bật bộ lọc SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
SMA tín hiệu dốc lên theo lookback 5
VÀ ADX(14) > 20
VÀ +DI > -DI, nếu bật bộ lọc DI
VÀ SMA(200) dốc lên, nếu bật bộ lọc xu hướng SMA
VÀ trạng thái Mua vừa mới xuất hiện, nếu bật chế độ chỉ vào tín hiệu mới
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
SMA tín hiệu đảo chiều xuống
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
SMA tín hiệu dốc xuống theo lookback 5
VÀ ADX(14) > 20
VÀ -DI > +DI, nếu bật bộ lọc DI
VÀ SMA(200) dốc xuống, nếu bật bộ lọc xu hướng SMA
VÀ trạng thái Bán vừa mới xuất hiện, nếu bật chế độ chỉ vào tín hiệu mới
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
SMA tín hiệu đảo chiều lên
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Logic chiến lược:
CNPS 05 phù hợp với các giai đoạn thị trường có xu hướng rõ ràng. SMA tín hiệu giúp xác định hướng di chuyển chính. ADX giúp lọc những giai đoạn thị trường có lực. DI giúp xác nhận lực đang nghiêng về bên Mua hay bên Bán.
Cấu trúc này giúp bot hạn chế tín hiệu nhiễu trong vùng sideway. Bot không chỉ nhìn độ dốc SMA, mà còn yêu cầu thị trường có đủ sức mạnh xu hướng và có xác nhận hướng từ DI.
Bộ lọc giờ:
Mặc định 09:00 – 14:30, nhằm tránh hai vùng biến động bất thường.
ATO 08:45 – 09:00 là giai đoạn khớp lệnh mở cửa. Giá thường có thể gap mạnh và tín hiệu kỹ thuật dễ bị nhiễu.
ATC và giao dịch thỏa thuận 14:30 – 15:00 là giai đoạn khớp lệnh đóng cửa. Giá có thể biến động mạnh hoặc đảo chiều nhanh.
Người dùng có thể điều chỉnh giờ bắt đầu và giờ kết thúc trong phần cài đặt bot.
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. phaisinh.online không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategy

Decision timeDecision Time is an intraday session overlay built around fair-value boxes and confirmation after a breakout retest. The script creates a box from a selected session's anchor candle, extends that box for the configured session duration, and then tracks whether price breaks out, retests, and confirms continuation with a second close outside the box.
The indicator supports multiple session anchors:
- Market Reopen
- Asia
- London
- New York Open
- New York PM
- Pre-news
How it works:
- When a selected session begins, the script captures the anchor candle.
- The fair-value box is built from either the anchor candle range or a fixed band around the chosen fair-price source.
- If price closes above the box, the script starts watching for a bullish retest that still holds above the box.
- If the next candle also closes above the box, the script prints a long signal.
- The bearish sequence is mirrored below the box.
Session behavior:
- Each session can be enabled or disabled independently.
- Each session box can use its own duration.
- The Asia session can optionally extend for the full day.
- The script can also color each session start candle and draw a separate rectangle around that start candle.
- A preview box shows the next upcoming session.
Main inputs:
- Session timezone and display timezone
- Session enable/disable toggles
- Per-session box lengths
- Fair-price source: Open, Midpoint, or Close
- Fair-value box mode: anchor candle range or fixed band
- Entry window after the anchor
- Maximum bars allowed between breakout and retest
- Retest touch and close conditions
- Signal limits and cooldown
- Session start candle colors and optional start-candle rectangles
Visual outputs:
- Session fair-value boxes
- Fair-price line
- Breakout and retest markers
- Long and short confirmation labels
- Session phase background shading
- Next session preview box
- Session start candle coloring
What makes this script different:
- It is session-anchored rather than using one continuous breakout model for the whole chart.
- It separates the breakout, retest, and confirmation steps instead of flagging the first close outside the range as the final signal.
- It allows different session box lengths and a full-day Asia mode, which makes it easier to adapt the same workflow across multiple market phases.
Important limitations:
- This is an indicator, not a strategy or automated execution system.
- It does not place orders, manage risk, or calculate performance.
- Signals depend on the selected session anchors, duration settings, and chart timeframe.
- The logic is designed for intraday use and may be less useful on higher timeframes or symbols with very different session behavior.
- A signal only means the configured box/retest conditions were met. It does not guarantee continuation or profitability.
This script is for chart analysis and workflow structure only. It is not financial advice. Indicator

Multi EMA SMA Pro - 5/13/20/50/100/200 - MTFMULTI EMA/SMA PRO — 5/13/20/50/100/200 + MTF
Nine independent moving averages in one indicator, each with its own length,
type, timeframe, color and width. Defaults give you the classic 20 / 50 / 100 /
200 on your chart timeframe, with 5 and 13 a click away.
EVERY LINE IS LABELLED
No more guessing which line is which. Each average is tagged at the right edge
with its length — and optionally its type, its timeframe, its current value, and
how far price sits from it in percent. You read "200 D +18.06%" straight off the
chart instead of hovering over lines to find out.
DAILY / WEEKLY / MONTHLY AVERAGES ON ANY CHART
Every slot has a Chart / Daily / Weekly / Monthly / Custom selector, so you can
sit on a 5-minute chart and still see exactly where the daily 200 and the weekly
200 are — the levels that actually decide intraday reversals. Slots 7, 8 and 9
come pre-set to 200 D, 30 W and 200 W. Each higher-timeframe line is tagged with
D, W or M so there is never any ambiguity about what you are looking at. Ask for
a timeframe below your chart and the slot quietly falls back to chart data rather
than returning misleading values.
INFO TABLE
An on-chart panel lists every enabled average, its current value, and how far
price is above or below it in percent, color-coded green and red. It is the
fastest way to tell whether price is extended and due a snap back, or resting on
support. Decimal precision is adjustable.
GOLDEN CROSS / DEATH CROSS, DONE PROPERLY
GC/DC detection is on by default and measured on the DAILY 50 vs 200 no matter
what timeframe you are viewing — so an intraday chart shows the real cross, not a
5-minute imitation of one. Markers carry their own context: "GC 50/200 D".
Lengths, timeframe and MA type are all configurable, or you can point the cross
logic at any two of your plotted lines instead.
EVERYTHING ELSE
- EMA / SMA / WMA / HMA / RMA / VWMA globally, or overridden per line
- Custom source, plot offset, transparency, per-line width and color
- Line / step-line / circles / cross plot styles
- Slope-based coloring (green rising, red falling)
- Ribbon fill between any two averages
- Alerts for price crossing each average, plus golden and death cross
- Palette chosen to stay readable on both light and dark chart backgrounds
A NOTE ON HIGHER-TIMEFRAME DATA
Leave "wait for bar close" off and the daily and weekly lines update live inside
the forming candle, which is usually what you want when trading. The trade-off is
that an intraday cross can appear and then disappear before the session closes.
Turn it on for confirmed, non-repainting values that step one bar late.
If you find this useful, a boost is appreciated. Suggestions and feedback welcome in the comments.
Open-source — feel free to study, fork, and adapt. Indicator

Volume + RVOL + Directional Delta [Clean]# Volume + RVOL + Directional Delta
## What this is
A volume pane with three layers: raw volume colored by relative volume, a
signed Directional Delta histogram, and a dashboard that reports **how each
number was actually produced**.
The third layer is the point. Relative volume and volume delta both depend on
data that is not always available, and most implementations substitute a
different measurement when the real one is missing — without saying so. This
indicator computes the same things everyone else computes, then tells you when
what you are looking at is not what the label claims.
Every fallback in the script is visible in the dashboard. There are no silent
substitutions.
---
## The problem it addresses
Two silent substitutions happen constantly in volume tooling.
**1. Time-of-day RVOL that isn't.** Comparing a bar to prior bars at the same
clock time is the right way to do intraday RVOL — 9:30 volume and 2:00 volume
are not the same population. But it only works if session bars land on
consistent clock times. On a 65-minute regular-hours chart there are six bars
per session and the opens repeat cleanly. Turn on extended hours and the
session runs about 14.8 bars, the opens drift, and the same-time search returns
almost nothing. Most scripts fall back to a rolling average at that point and
keep displaying the number as though nothing changed.
**2. Volume delta that is really just bar direction.** Estimating delta
requires summing signed intrabar volume from a lower timeframe. TradingView's
intrabar budget is finite — at 65m/1m that is 65 intrabars per chart bar,
covering roughly a year of history before `request.security_lower_tf()` starts
returning empty arrays. The usual fallback is a chart-bar proxy: positive if
the bar closed up, negative if it closed down. That proxy can only ever return
exactly ±volume, i.e. ±100% delta. It is not a noisier version of intrabar
delta. It is a different measurement with a different range, and a single proxy
bar contributes the largest value any bar can contribute.
Both substitutions are reasonable as fallbacks. Neither is acceptable as a
silent one.
---
## Relative volume
**Baseline statistic.** Median by default rather than mean. The mean is dragged
upward by exactly the news-driven spikes RVOL exists to detect, which makes a
fixed threshold like 2.0x mean different things on different tickers and in
different regimes. The median keeps the threshold comparable across names.
**Time-of-day mode** walks backward collecting prior bars whose open lands on
the same hour and minute as the current bar, then takes the median of those.
The setting is a **target sample count, not a search window**. This matters
more than it sounds. A search-window setting produces a completely different
statistical baseline on every timeframe — 120 bars finds about 20 samples on
65m, 12 on 39m, and 4 on 15m. Asking for 20 comparable sessions instead means
20 sessions wherever they are reachable. A separate maximum search distance
bounds how far the scan may walk to find them.
Sizing guidance, on a 390-minute regular-hours session:
Chart TF Bars/session Search distance for 20 samples
10m 39 ~780
15m 26 ~520
39m 10 ~200
65m 6 ~120
78m 5 ~100
130m 3 ~60
195m 2 ~40
The default 1000-bar ceiling reaches 20 samples down through 10m. Some
combinations are simply unreachable — 20 sessions on a 1-minute chart would
need 7800 bars — and those degrade to the rolling baseline and say so.
**Attainment is a three-state result**, because once the setting means "20
sessions", clearing a bare minimum of 10 is not the same as meeting the
request:
MODE TOD target met — the baseline you configured
MODE TOD* minimum met, target missed — usable, but not what you asked
MODE ROLL* minimum missed — fell back to rolling entirely
The middle state keeps a useful 15-sample baseline rather than discarding it,
while refusing to report it as though 20 sessions had been achieved.
**Coloring.** Gray below the high threshold, green at high RVOL, gold at
extreme. Thresholds are configurable.
---
## Bar completion, and why nothing is projected
RVOL divides a **partial** current bar by a median of **completed** bars. It
therefore reads low at the start of a bar and climbs throughout. A 0.4x forty
minutes into a 65-minute bar is not the same statement as a 0.4x at the close.
This is deliberately not projected to a full-bar estimate. Intraday volume is
U-shaped, so scaling linearly by elapsed time overstates near the open and
understates into the close — and an extrapolated figure displayed to two
decimals invites more trust than it has earned. The honest fix is a baseline
built from the same elapsed *fraction* of prior same-time-of-day bars, which
requires intrabar history for every baseline bar and is a substantially larger
build.
So the indicator reports completion instead and lets you discount. The `BAR%`
cell turns amber below 95%, which is precisely when the RVOL cell beside it is
understated.
One caveat: this is wall-clock elapsed against nominal bar duration. A bar
truncated by a session boundary or a holiday early close reads below 100% even
at its close. In time-of-day mode such bars are compared against other bars at
the same clock time, so RVOL itself stays meaningful — only the completion
figure misreports.
---
## Directional Delta
Each lower-timeframe bar's entire volume is signed by that bar's own candle
direction, with dojis resolved against the prior close, and the signed values
are summed across the chart bar.
**It is called Directional Delta because that is what it is.** It is not
market-buy volume minus market-sell volume. No lower-timeframe reconstruction
can see bid/ask trade classification; it can only sign small bars by their
direction. That is genuinely useful information about intrabar pressure, and it
is not order flow, and the name should not imply otherwise.
**Cumulative Directional Delta uses real intrabar bars only.** Bars that fell
back to the proxy are excluded from the total rather than included and flagged.
This is worth explaining, because it drives the display. Proxy bars are not
scattered randomly through the window — the intrabar budget runs out going
*backward*, so they form the oldest contiguous block. Filtering therefore
produces a **shorter, more recent window**, not a cleaned full-length one. The
column header reports the real bar count for that reason:
57B DΔ +8.7M
57B DΔ% +12.6%
VALID 57/60
You asked for 60 bars and you are looking at a clean measurement over 57. With
zero valid bars both cells read `n/a` rather than a confident `+0`.
Cumulative delta % is total delta divided by total volume across those same
valid bars — not the average of per-bar percentages.
The lookback is left in bars rather than normalized to sessions, deliberately.
It means different amounts of market time on different charts — 60 bars is ten
sessions on 65m but 2.3 sessions on 15m — and the tooltip says so. Which span
you want is a judgment, not something the script should make for you.
---
## Dashboard reference
RVOL current bar volume / active baseline
BAR% bar completion; amber below 95%, when RVOL is understated
MODE TOD / TOD* / ROLL / ROLL*, plus "med" or "avg"
SAMP 20+ (target met with margin) / 20 (met exactly) / 15/20 (short)
BAR DΔ current bar Directional Delta
BAR DΔ% as a share of bar volume
nB DΔ cumulative over valid bars; header states how many
nB DΔ% cumulative delta / cumulative volume, same bars
VALID valid bars / requested bars
Δ TF intrabar timeframe in use, or why there isn't one
The `Δ TF` cell distinguishes four outcomes, because "no intrabar data" has
causes that call for different responses:
1 / 15S intrabar data genuinely in use
Chart* a valid lower timeframe was requested, no data came back
INVALID manual timeframe is not lower than the chart — fix the setting
Chart no lower timeframe exists at all (1-second chart)
`INVALID` exists because entering 65m as the delta timeframe on a 65m chart
used to display a calm white "Chart", identical to the legitimate case. Both
fall through to the proxy; only one is a mistake.
**Color convention.** Amber means one thing throughout: *the number is usable
but is not the measurement you asked for.* Red appears in exactly one place and
means *this setting cannot work as entered*. Keeping those separate is what
makes the pane readable at a glance.
---
## Settings guidance
- **65m regular hours:** defaults work as-is. About 120 bars of search finds
the 20-sample target.
- **15m and 10m:** also fine at the 1000-bar default, but the scan runs much
further. If the script becomes slow, turn off *Compute Time-of-Day Baseline
on History* — historical bar coloring then uses the rolling baseline while
the dashboard uses time-of-day, which is a real inconsistency and is why it
is a visible toggle rather than a silent optimization.
- **Extended-hours charts:** time-of-day will degrade to `ROLL*`. Session bar
opens do not repeat. Either switch to regular hours or accept the rolling
baseline knowingly.
- **Daily and above:** time-of-day is inapplicable and is bypassed.
- **Delta timeframe:** leave on automatic. It steps down correctly including on
1-minute charts. Sub-minute intrabar data requires a higher TradingView plan
tier; on a lower tier the request returns empty and `Δ TF` reports `Chart*`.
- **Below ~15 samples**, the median becomes sensitive to holiday early-close
sessions, whose truncated final bars carry structurally low volume.
---
## Alerts
Six conditions. High RVOL and Extreme RVOL are straightforward.
The two combined alerts — extreme volume with positive or negative Directional
Delta — **require real intrabar data**. On a proxy bar the delta sign is
nothing more than the candle body's direction, so an ungated version would fire
on "heavy volume, bar closed up" while appearing to describe something more.
Two ungated variants are provided separately and named for what they actually
test: *Extreme Volume + Up Bar* and *Extreme Volume + Down Bar*, each stating in
its own message that it does not test Directional Delta.
---
## What this is not
- It does not project or estimate finished bar volume.
- Directional Delta is not bid/ask trade classification and does not claim to be.
- It makes no directional claim, generates no entries, and has no backtest.
- The proxy fallback is not "close enough." It is excluded from cumulative
figures and labeled where it appears, so you can decide whether a number is
usable for what you are doing.
---
## Implementation notes
Both rolling statistics (`ta.sma` and `ta.median`) are evaluated
unconditionally and then selected, rather than being called inside a
conditional branch, which would produce an inconsistent series.
The sample scan probes for one more than the target, then discards it. That is
what makes `20+` truthful: it means a 21st match genuinely existed, not merely
that the loop stopped. A bare `20` means the target was met with no margin left
in the window, which is worth distinguishing.
The scan exits as soon as the target is met, so the search ceiling costs
nothing on timeframes that reach it — 65m stops near bar 126 regardless of the
setting. It is not free where the target is unreachable: the loop then runs the
full distance on every bar, which is what the history toggle is for.
`todActive` reflects what the code actually used, never what was requested. The
dashboard reads that flag rather than the input, which is what prevents MODE
from displaying `TOD` while a rolling baseline is in use.
The compact number formatter uses `"#0"` rather than `"#"` for sub-thousand
values — a bare `"#"` drops the digit on sub-1 values and renders a lone minus
sign.
Open source. Indicator

Macro HUDMacro HUD is an on-chart panel that shows the macro context around the instrument you are trading, so you can read price with the broader backdrop in view rather than in isolation.
Most indicators transform the price already on your chart into another form of the same price. Macro HUD does something different: it reads a set of other markets and presents their current state as context on a single panel, so you do not have to open several extra charts or an economic calendar to see the wider picture. It is a context dashboard, not a signal generator.
What it shows
The panel has four sections:
Macro engine — the US Dollar Index (DXY), the US 10-year and 2-year Treasury yields, crude oil, and the VIX. Each row shows its current value and a direction arrow measured over a lookback you set. The VIX row adds a volatility-regime band: Calm, Normal, Stressed, or Panic.
Regime — two plain-language reads derived from the rows above: a dollar read (bid or offered, from its recent direction) and a risk read (risk-on, risk-off, or mixed, from a chosen index's trend together with the VIX band).
Watchlist — up to five instruments of your choice, each labelled Bull or Bear depending on whether its price sits above or below a moving average, so you can see the directional state of a whole basket at a glance.
Event — an optional manual countdown to your next key economic releases. You enter the events yourself; the panel displays whichever is soonest and turns red inside a stand-down window you define.
How it works
Every value in the panel is requested from another symbol on a timeframe you choose (Daily by default) using request.security. The direction arrows compare the current value to the value a set number of bars earlier. The VIX band and the dollar and risk reads are simple threshold and trend rules applied to those requested values — the band uses fixed volatility thresholds, and the risk read combines an index's position relative to its moving average with the VIX band. The watchlist Bull/Bear flags compare each requested symbol's price to an EMA of its own price. The event countdown compares the current time to the timestamps you enter and shows the nearest upcoming one. Nothing in the panel is predictive; it reports the current state of external data.
Why it is original, and why these parts are combined
Macro HUD is not a single built-in republished, and it is not a mashup of overlapping signals. Each component answers a different question, and they are gathered together because a discretionary trader usually needs all of them at once before acting:
The macro engine answers "what is the broad backdrop?" — the dollar, rates, oil, and volatility.
The regime rows condense that backdrop into a plain read that can be absorbed at a glance.
The watchlist answers "what state is my basket in right now?" across several instruments without switching charts.
The event row answers "is it safe to act, or is a major release imminent?" — the one piece Pine cannot source on its own.
The purpose of the combination is to assemble, on one panel, the external context a trader would otherwise gather from several separate windows plus an economic calendar. No component duplicates another; each covers a distinct part of the question "should I be looking at this market now, and with what lean?" That specific, purpose-built combination is what the script contributes.
How to use it
Add it to any chart. Open the settings and point the macro and watchlist symbols at instruments your data plan supports, set the read timeframe (Daily gives the broad regime regardless of your chart timeframe), and choose the EMA length used for the Bull/Bear flags. If you follow economic events, type your next few releases into the event slots. The panel then updates live. Panel text colour is theme-aware by default and can be forced to black or white.
Limitations and things to be aware of
Pine cannot read the economic calendar or news, so the event slots are filled in by hand. If you do not maintain them, the event row simply shows that no event is set.
The direction arrows show short-term direction over your chosen lookback, not the absolute level. A market can show a down arrow while still being historically high, so read the arrow as recent drift, not position.
The regime reads are deliberately simple threshold and trend rules, not a proprietary model. They are a quick summary, not a forecast.
Some symbols (DXY, yields, VIX) depend on your TradingView data plan. If a row shows "n/a", open the settings and replace that symbol with one your plan provides. The script handles missing symbols without failing.
All values reflect the chosen read timeframe and update on that basis.
Scope
Macro HUD assembles context. It does not generate buy or sell signals, predict direction, or tell you what to do, and it makes no performance claims. The interpretation and every trading decision remain entirely yours.
This script is open-source. The full Pine code is available on this page for anyone to read, verify, and build upon.
Indicator

Indicator

Dynamic Liquidity ZonesDynamic Liquidity Zones is a price-action indicator designed to identify equal highs and equal lows where resting liquidity may be concentrated.
The indicator compares confirmed pivot points and creates a liquidity zone when two pivot highs or two pivot lows form within the selected equality threshold.
Liquidity Zone Types
EQH — Equal High liquidity zone
Equal highs may represent buy-side liquidity resting above previous highs. EQH zones are displayed using the selected bearish-zone color.
EQL — Equal Low liquidity zone
Equal lows may represent sell-side liquidity resting below previous lows. EQL zones are displayed using the selected bullish-zone color.
Dynamic Detection
The indicator uses adjustable left- and right-side pivot lengths to confirm meaningful swing highs and lows.
When two confirmed pivots are within the selected percentage threshold, a zone is drawn between their prices. The two pivot locations are marked with circular points, making it easier to identify the structure responsible for creating the zone.
Each active zone automatically extends to the latest bar until price sweeps its outer boundary.
Liquidity Sweeps
An EQH zone is considered swept when price trades above its highest boundary.
An EQL zone is considered swept when price trades below its lowest boundary.
After a sweep, the user can choose to:
• Keep the zone visible in a faded historical state
• Automatically delete the swept zone from the chart
Retained zones are relabeled as Swept EQH or Swept EQL, allowing previous liquidity events to remain available for market-structure review.
Volume Information
Optional volume labels display the volume associated with each pivot bar. The active zone label displays the combined pivot-bar volume used to form the liquidity zone.
Large values are automatically formatted using K and M abbreviations.
Zone Consolidation
Nearby active zones of the same type are grouped visually to reduce label congestion.
When multiple EQH or EQL zones exist within the consolidation range, the indicator displays a combined label such as:
2x EQH
3x EQL
The label can also display the combined pivot volume for the grouped zones.
Features
• Automatic equal-high and equal-low detection
• Adjustable pivot confirmation lengths
• Adjustable equality threshold
• Tracks multiple active liquidity zones
• Optional combined pivot-volume display
• Optional dashed zone midline
• Custom bullish and bearish colors
• Adjustable zone transparency
• Active zone-label consolidation
• Automatic sweep detection
• Option to retain or delete swept zones
• Optimized active-zone limit for lower-timeframe charts
Liquidity zones represent areas where orders may be resting, but they do not guarantee a reversal or continuation. Price can sweep a liquidity area and continue moving in the same direction.
This indicator should be combined with market structure, displacement, trend, session context, and appropriate risk management.
For educational and informational purposes only. This indicator is not financial advice and does not guarantee future results.
Indicator

Relative Volume (RVOL) PercentileRelative Volume (RVOL) Percentile
What it does
Relative Volume (RVOL) Percentile shows when participation on the current chart bar is unusual versus its own recent history. The pane displays a relative-volume histogram colored as Dry-up, Normal, High, or Extreme, with an optional norm line at 1.0x. It describes observed volume conditions only and does not generate directional trade signals.
How it works
The script compares each bar with a rolling sample of completed bars from the same chart timeframe. The current bar is excluded from both the baseline and percentile sample.
The baseline is either the median or simple moving average of the previous Lookback bars.
RVOL is current volume divided by that baseline. A value of 1.0 means current volume equals the selected norm.
Percentile rank is the percentage of the previous Lookback volume values that are less than or equal to current volume.
Dry-up is below the Dry-up threshold, Normal is below High, High is below Extreme, and Extreme is at or above the Extreme threshold.
How to use it
Add the script to a chart and choose a Lookback that represents the recent activity you want to compare.
Read bars near 1.0x as close to the selected volume norm, then use the stage color to judge how unusual that bar is within the recent sample.
Use High or Extreme transitions to identify unusually active bars and Dry-up transitions to identify unusually quiet bars.
Enable price-bar coloring or the last-bar RVOL label only when that extra context is useful.
Inputs
Lookback (Bars) - Number of prior completed chart bars used for both the baseline and percentile sample. Range 2-1000, default 20.
Baseline Method - Median reduces the influence of isolated spikes; SMA uses the arithmetic mean. Default Median.
Dry-up Below (%) - Percentile below which volume is classified as Dry-up. Range 0-100, default 15.
High From (%) - Percentile from which volume is classified as High. Range 0-100, default 80.
Extreme From (%) - Percentile from which volume is classified as Extreme. Range 0-100, default 95. Thresholds must remain in ascending order.
Show Histogram - Shows or hides the RVOL histogram. Default on.
Show Reference Line (Norm) - Shows or hides the 1.0x norm line. Default on.
Color Price Bars - Applies the same stage color to price bars on the main chart. Default off.
Show Value Label - Shows the current RVOL value on the last bar only. Default off.
Text Size - Numeric size for the optional last-bar label. Range 10-24, default 12.
Opacity (%) - Controls visual opacity. Range 0-100, default 70.
Dry-up / Normal / High / Extreme colors - Sets the four stage colors used by the histogram and optional price-bar coloring.
Signals and alerts
Relative Volume - Extreme - fires on a confirmed bar when the stage newly becomes Extreme.
Relative Volume - High - fires on a confirmed bar when the stage crosses from below High into High or Extreme.
Relative Volume - Dry-up - fires on a confirmed bar when the stage newly becomes Dry-up.
Repainting
The baseline and percentile sample use only prior chart bars. Alert transitions require the current chart bar to be confirmed, so an alert state is not finalized from an unfinished bar. The histogram can move with live volume while the current bar is open because it describes that still-forming bar; closed historical bars are not rewritten afterward.
Limitations
The script uses total chart-bar volume only. It does not estimate buy/sell delta, footprint data, or intrabar order flow.
Percentile rank is relative to the chosen Lookback, so different sample lengths can classify the same bar differently.
Markets or symbols with missing, sparse, or non-comparable volume data can produce incomplete or less useful readings.
The script measures volume anomaly only. It does not predict direction, continuation, reversal, or future price movement.
This script is a charting tool for educational purposes. It does not provide financial advice and does not predict future price movement. Trading carries risk; decisions and their outcome remain yours. Indicator

Pivot MA StructurePivot MA Structure— Complete User Guide
1. General Purpose
This indicator combines several independent market-reading components into one framework:
Pivot-controlled directional moving averages
Bullish and Bearish market-structure shifts
Pre-break structure candidates
Trend-continuation markers
Shift-direction MA retests
Anchored VWAP equilibrium
RSI 50 equilibrium
Fair Value Gaps and breakers
Long/Short health scores
A real-time information dashboard
Selectable alerts
It is an indicator, not an automated strategy. It does not place orders, calculate position size, or automatically manage stop-loss and take-profit orders.
Its primary objective is to answer five questions:
What is the latest structural direction?
Which directional Pivot MA is currently active?
Do structure and the active MA agree?
Do VWAP and RSI support the same direction?
Is there a suitable continuation or retest location for entry?
2. The Core Reading Model
The indicator separates market information into three layers.
Structural layer
This layer detects:
Bullish Shift
Bearish Shift
Bullish continuation
Bearish continuation
Unbroken bullish and bearish candidates
A Shift represents a change in the direction of confirmed structure breaks.
Directional MA layer
This layer determines whether the active moving-average condition is:
Bullish
Bearish
Ghost/inactive
Still waiting for a valid pivot
Only one directional MA can be active at a time.
Confirmation layer
The following secondary filters measure the quality of the directional condition:
Anchored VWAP
RSI relative to 50
Fair Value Gaps
Directional MA retests
Health score
A structural signal does not automatically imply that all confirmation filters agree.
3. Pivot Moving Average System
Default settings
MA type: EMA
MA length: 50
Pivot strength: 5
Pivot qualification: All Confirmed Pivots
Source: Pivot Side
The MA type can be changed to:
EMA
SMA
WMA
RMA
HMA
Pivot Side source
When MA Source = Pivot Side:
The bullish MA is calculated from low.
The bearish MA is calculated from high.
This creates two distinct directional averages:
Green MA for bullish conditions
Red MA for bearish conditions
If Close or HL2 is selected, both averages use the selected common source.
How a Pivot MA is created
A bullish Pivot MA becomes available after a qualifying confirmed low pivot.
A bearish Pivot MA becomes available after a qualifying confirmed high pivot.
The pivot does not become known immediately. With Pivot Strength set to 5, the system requires five bars on the right side of the pivot before confirming it.
Therefore, pivot activation is intentionally delayed.
Pivot Qualification
All Confirmed Pivots
This is the default mode.
Every confirmed low pivot can refresh the bullish MA state.
Every confirmed high pivot can refresh the bearish MA state.
This allows higher lows in an uptrend to reactivate the bullish side and lower highs in a downtrend to refresh the bearish side.
HH / LL Only
This is a more selective mode.
A bearish MA trigger requires a pivot high above the previous pivot high.
A bullish MA trigger requires a pivot low below the previous pivot low.
This mode generates fewer MA refresh events and may leave an MA in ghost mode for longer.
4. Active and Ghost MA Logic
Active bullish MA
The bullish MA is eligible to become active when:
The bullish MA exists.
It has not remained locked by an unresolved break.
Price is at or above the bullish MA.
The bullish MA is rising.
Active bearish MA
The bearish MA is eligible when:
The bearish MA exists.
It has not remained locked by an unresolved break.
Price is at or below the bearish MA.
The bearish MA is falling.
One active MA at a time
The indicator does not allow both MAs to be active simultaneously.
If only the bullish side is eligible:
Bullish MA becomes active.
Bearish MA becomes ghost.
If only the bearish side is eligible:
Bearish MA becomes active.
Bullish MA becomes ghost.
If neither side is eligible:
Both lines can appear as ghost lines.
If both sides are technically eligible during compression:
A new bearish pivot or downward bar movement gives priority to the bearish MA.
Otherwise, the bullish MA receives priority.
Active line thickness
The active directional MA is always displayed one step thicker than a ghost MA.
This allows the currently accepted directional condition to be identified visually without relying only on color.
Ghost lines
A ghost line is a faded directional MA.
Ghost status means that the MA still exists and is still calculated, but it is not currently accepted as the active directional condition.
A ghost line is not frozen. Its value continues to move because the underlying MA calculation continues.
MA break behavior
The bullish MA is broken when price crosses below it according to the selected break confirmation.
The bearish MA is broken when price crosses above it.
The break method can be:
Close: requires the closing price to cross the MA.
Wick: reacts to the bar’s low or high crossing the MA.
After a genuine break, the line becomes ghosted. A new qualifying same-side pivot can reset its broken state.
5. Market Structure Engine
Default structure length
Structure Length: 12
The engine uses an odd-length fractal model. An even input is internally advanced to the next odd number.
Therefore:
Input 12 becomes an internal 13-bar fractal.
Pivot strength becomes 6 bars on each side.
This is different from using 12 left bars and 12 right bars. It is a full fractal-window interpretation.
Confirmed structure pivots
The engine continuously tracks:
Latest confirmed fractal high
Latest confirmed fractal low
These become potential break candidates.
A structure pivot appears only after its required right-side bars have completed.
6. Candidate Lines
Bullish Break Candidate
A confirmed fractal high creates a bullish break candidate.
It is displayed as:
Green dotted line
Bullish Break Candidate text above the line
This level represents the price that must be exceeded for an upward structure break.
Bearish Break Candidate
A confirmed fractal low creates a bearish break candidate.
It is displayed as:
Red dotted line
Bearish Break Candidate text below the line
This level represents the price that must be broken for a downward structure break.
Candidate projection
The default projection is five bars to the right.
The candidate does not extend infinitely. On every new bar:
Its right endpoint moves forward.
It remains five bars ahead of the current bar.
It stops when broken or replaced by a newer same-side pivot.
Candidate replacement
When a newer confirmed pivot of the same side appears:
The previous unbroken candidate is deleted.
A new candidate begins from the newer pivot.
This ensures that the chart emphasizes the latest actionable structure level.
7. Bullish and Bearish Shift Logic
The internal logic follows a CHoCH-style direction-change model, but the chart does not display the word “CHoCH.”
It uses:
Bullish Shift
Bearish Shift
Bullish Shift
A Bullish Shift occurs when:
The last confirmed structure break was downward.
Price subsequently breaks the latest unbroken fractal high.
The break can be confirmed by:
Close above the level, or
Wick above the level
depending on the selected Break Confirmation.
When confirmed:
The candidate line ends at the breakout bar.
The line becomes a stronger green dotted shift segment.
Bullish Shift appears above the middle of the segment.
The dashboard’s Latest Shift changes to Bullish Shift.
The bullish retest detector becomes armed.
Bearish Shift
A Bearish Shift occurs when:
The last confirmed structure break was upward.
Price subsequently breaks the latest unbroken fractal low.
When confirmed:
The candidate line ends at the breakdown bar.
It becomes a stronger red dotted shift segment.
Bearish Shift appears below the middle of the line.
The dashboard changes to Bearish Shift.
The bearish retest detector becomes armed.
First structure break
The first break establishes the initial direction.
Because no previous opposite break exists, it is not classified as a Shift.
It is treated as a continuation break and receives a directional triangle.
8. Trend-Continuation Triangles
The indicator does not draw BOS lines.
Instead, a same-direction continuation break is marked directly on the breaking candle.
Bullish continuation
A bullish continuation is shown as:
Green upward triangle
Located below the breakout candle
It means that an upward break occurred without reversing the previous break direction.
Bearish continuation
A bearish continuation is shown as:
Red downward triangle
Located above the breakdown candle
It means that a downward break occurred without reversing the previous break direction.
How to interpret continuation marks
Continuation triangles are not fresh reversal signals.
They are better interpreted as confirmation that the existing structural direction is continuing.
A continuation marker is generally more useful when:
The matching directional MA is active.
Price is on the correct side of VWAP.
RSI supports the same direction.
The breakout is not entering directly into an opposing FVG or major swing level.
Avoid treating every continuation triangle as an automatic market entry. Entering immediately after an extended breakout can create poor risk-to-reward.
9. Directional MA Retest — “R” Marker
Important definition
In the current version, the R marker detects a retest of the same-direction Pivot MA, not the horizontal dotted shift line.
After a Bullish Shift:
The indicator monitors the green bullish Pivot MA.
After a Bearish Shift:
It monitors the red bearish Pivot MA.
Bullish retest
After a Bullish Shift, the retest detector waits for a later candle whose range intersects the green bullish MA:
Candle low is at or below the MA.
Candle high is at or above the MA.
When the first valid touch occurs:
A green R appears below the candle.
The bullish retest alert can trigger.
The retest detector stops waiting until a new Shift occurs.
The green line can be active or ghost. The retest detector only requires the corresponding bullish MA to exist.
Bearish retest
After a Bearish Shift, the first later candle that intersects the red bearish MA produces:
A red R
Located above the candle
A bearish retest alert opportunity
Why an R may not appear
An R will not appear when:
No valid Bullish or Bearish Shift has occurred.
The contact happens on the Shift candle itself.
The candle does not actually intersect the MA value.
The first retest after that Shift has already been marked.
A new opposite Shift replaced the previous retest direction.
The corresponding directional MA does not yet exist.
Show Directional MA Retests is disabled.
The visual toggle does not disable the underlying alert calculation.
10. Anchored VWAP Equilibrium
Default status
The VWAP line is enabled by default.
Available anchors
Session
Week
Month
Session
The VWAP resets with the daily/session boundary.
Week
The VWAP resets at the beginning of each week.
Month
The VWAP resets at the beginning of each month.
Horizontal VWAP presentation
The indicator does not plot the entire conventional curved VWAP history.
Instead, it takes the latest anchored VWAP value and displays it as a horizontal equilibrium reference.
Default presentation:
100 bars to the left
10 bars to the right
VWAP label on the right
Dashed neutral-colored line
The right-side length and label offset are adjustable.
Bullish interpretation
Price above VWAP suggests that current price is trading above the volume-weighted equilibrium.
This supports a bullish setup.
Bearish interpretation
Price below VWAP suggests that price is trading below the volume-weighted equilibrium.
This supports a bearish setup.
VWAP as a trade-management filter
For an existing long:
Remaining above VWAP supports the health of the position.
Losing VWAP removes one bullish health point.
Reclaiming VWAP can restore that point.
For an existing short:
Remaining below VWAP supports the bearish condition.
Moving above VWAP weakens the short health score.
VWAP alone is not an entry or exit signal. It is an equilibrium filter.
11. RSI 50 Price Equilibrium
Default settings
RSI Length: 14
RSI line: enabled
Midpoint: 50
HUD interpretation
RSI at or above 50 is bullish.
RSI below 50 is bearish.
Horizontal RSI 50 price line
A literal RSI value of 50 cannot be plotted meaningfully on the same price scale as BTC, forex, or commodities.
Therefore, the indicator stores the closing price where RSI most recently crossed 50.
That price becomes the RSI 50 horizontal equilibrium level.
It represents the latest price associated with a momentum-regime transition.
The line:
Is green when the current RSI is above 50.
Is red when the current RSI is below 50.
Extends a configurable number of bars left and right.
Has an offset label on the right.
Practical use
For a long position:
RSI above 50 supports positive momentum.
RSI falling below 50 reduces long health.
For a short position:
RSI below 50 supports negative momentum.
RSI reclaiming 50 reduces short health.
RSI 50 should be used as confirmation, not as a standalone trigger.
12. Fair Value Gap Engine
The FVG engine is enabled by default.
It supports:
Standard FVG mode
Breaker mode
Bullish and bearish zones
ATR threshold filtering
Multiple mitigation methods
Overlap filtering
Midlines
Optional right extension
Optional raid tracking
Bullish FVG
A bullish FVG is created when the current low is above the high from two bars earlier, producing a three-candle imbalance.
The engine also applies the selected ATR threshold to filter insignificant gaps.
A bullish FVG is normally interpreted as:
An imbalance below price
A possible pullback support area
A potential location for bullish continuation or mitigation
Bearish FVG
A bearish FVG is created when the current high is below the low from two bars earlier.
It is generally interpreted as:
An imbalance above price
A possible resistance area
A potential bearish pullback or mitigation location
Show Last
Show Last determines how many recent bullish and bearish FVGs are displayed.
With a value of 5, the engine can show:
Five recent bullish zones
Five recent bearish zones
subject to mitigation and overlap removal.
Threshold
The threshold applies an ATR-based significance filter.
A value of 0 accepts all qualifying gaps.
Higher values require a stronger displacement relative to ATR.
Increasing the threshold generally produces fewer but more significant FVGs.
Mitigation modes
Close
Uses the candle body boundary as the mitigation trigger.
For a bullish FVG, the body must penetrate below the relevant lower boundary.
For a bearish FVG, the body must penetrate above the relevant upper boundary.
Wick
Uses the candle’s full high/low range.
This is the most sensitive mitigation method.
Avg
Uses the midpoint of the gap.
This treats a move through the FVG’s average price as mitigation.
FVG mode
In standard FVG mode:
The zone remains visible while active.
It is removed when the selected mitigation condition is satisfied.
Breakers mode
In Breakers mode:
The original FVG is tracked.
When mitigated, it becomes a breaker.
Its directional display changes to the opposite-side color.
It remains until the breaker’s opposite invalidation condition occurs.
Hide Overlap
When enabled, overlapping FVGs are filtered.
The newest FVG is compared against:
Older FVGs in the same direction
FVGs in the opposite direction
Overlapping stored zones can be removed to reduce visual clutter.
Midline
When enabled, the midpoint of each FVG is displayed.
The midpoint can be useful as:
A partial mitigation level
A mean-reversion reference
A refined entry or invalidation location
Extend FVG
When disabled, FVG drawings end at the current bar.
When enabled, active FVG zones extend to the right.
Display Raids
Raid tracking looks for liquidity interactions around an active FVG.
For a bullish FVG, it can track a move below the upper FVG boundary followed by a close back above it.
For a bearish FVG, it can track a move above the lower boundary followed by a close back below it.
Raid locations are displayed with a line and an x marker.
13. Information HUD
The information table summarizes the indicator’s current state.
Latest Shift
Possible values:
Bullish Shift
Bearish Shift
Waiting
This row stores the most recent genuine opposite-direction structure break.
It does not reset to neutral after a few bars. It remains bullish or bearish until an opposite Shift occurs.
Bullish Pivot MA
Possible values:
Waiting
Active
Ghost
Waiting
No qualifying bullish pivot has created the bullish MA state yet.
Active
The bullish MA currently satisfies the directional activation logic.
Ghost
The bullish MA exists but is not currently accepted as active.
Bearish Pivot MA
Uses the same status definitions for the red bearish MA.
Shift + MA
Possible values:
Bullish Match
Bearish Match
No Match
Bullish Match
Requires:
Latest Shift is bullish.
Bullish Pivot MA is active.
Bearish Match
Requires:
Latest Shift is bearish.
Bearish Pivot MA is active.
No Match
Structure and the active directional MA do not currently agree.
This is a warning that the setup lacks core confluence.
VWAP
Possible values:
Price Above
Price Below
Unavailable
This reports the current price’s relationship with the selected anchored VWAP.
RSI
Displays:
Current RSI value
Above 50 or Below 50
Example:
56.4 / Above 50
Long Health
The long score counts currently satisfied bullish conditions.
Short Health
The short score counts currently satisfied bearish conditions.
Composite Bias
Possible values:
Bullish
Bearish
Balanced
The result is determined by comparing Long Health with Short Health.
Long Health greater than Short Health → Bullish
Short Health greater than Long Health → Bearish
Equal values → Balanced
Composite Bias is a comparison of rule counts, not a forecast.
14. Health Score Calculation
With all default score filters enabled, each side has four factors.
Long Health factors
One point is awarded for each condition:
Latest Shift is Bullish.
Bullish Pivot MA is active.
Price is above VWAP.
RSI is at or above 50.
Short Health factors
One point is awarded for each condition:
Latest Shift is Bearish.
Bearish Pivot MA is active.
Price is below VWAP.
RSI is below 50.
Score examples
100% — 4/4
All directional conditions agree.
This is the strongest confluence state produced by the dashboard.
It does not mean the trade has a 100% probability of success.
75% — 3/4
The setup is directionally favorable, but one filter disagrees.
Examples:
Bullish Shift and bullish MA are aligned, but RSI is below 50.
Bearish structure is aligned, but price is still above VWAP.
50% — 2/4
The condition is mixed.
This often occurs during:
Transition
Consolidation
Pullback
Delayed confirmation
Conflict between structure and momentum
25% — 1/4
Only one filter supports the direction.
This is generally a weak environment for initiating a new position.
0% — 0/4
None of the directional filters support that side.
Disabling score filters
If VWAP is removed from the score, the denominator decreases.
If RSI is also removed, only two core factors remain:
Shift direction
Active directional MA
The displayed percentage automatically adjusts to the number of enabled factors.
Important limitation
Health is a confluence percentage, not a statistically measured win probability.
A 100% Long Health reading means four out of four programmed bullish conditions are true. It does not mean the market has a 100% chance of rising.
15. Suggested Long Entry Framework
Core long condition
The preferred long environment is:
Latest Shift = Bullish Shift
Bullish Pivot MA = Active
Shift + MA = Bullish Match
This is the minimum structural and directional agreement.
Additional confirmation
A higher-quality long condition may also include:
Price above VWAP
RSI above 50
Long Health at 75% or 100%
Bullish FVG below or around the entry
No large bearish FVG immediately above
A green R retest marker
Aggressive long entry
An aggressive trader may enter near the Bullish Shift breakout.
Risks:
The breakout may be extended.
Stop distance may be large.
Price may return to the broken structure or MA before continuing.
Conservative long entry
A more conservative sequence is:
Bullish Shift appears.
Bullish MA becomes active or remains directionally valid.
Price stays above or reclaims VWAP.
RSI remains above or reclaims 50.
Price pulls back into the green MA.
A green R appears.
The retest candle shows rejection or closes constructively.
This avoids chasing the initial breakout.
Continuation entry
A green triangle can support a continuation entry when:
The dashboard already has bullish alignment.
Price is not excessively extended above the MA.
The continuation break has room before the next bearish FVG or swing resistance.
A triangle by itself is not enough.
16. Suggested Short Entry Framework
Core short condition
The preferred short environment is:
Latest Shift = Bearish Shift
Bearish Pivot MA = Active
Shift + MA = Bearish Match
Additional confirmation
A higher-quality short may include:
Price below VWAP
RSI below 50
Short Health at 75% or 100%
Bearish FVG above or near the entry
No major bullish FVG immediately below
A red R retest marker
Conservative short entry
A conservative bearish sequence is:
Bearish Shift appears.
Bearish Pivot MA becomes active.
Price remains below or rejects VWAP.
RSI remains below 50.
Price rallies back into the red MA.
A red R appears.
The retest candle rejects the MA or closes bearishly.
17. How to Stay in a Position
Staying in a long
A long remains structurally healthier while:
Latest Shift remains bullish.
Bullish Pivot MA remains active.
Price remains above VWAP.
RSI remains above 50.
Long Health remains at 75% or 100%.
Bullish FVGs below price continue to act as support.
No Bearish Shift is created.
Early long weakness
Potential deterioration begins when:
RSI falls below 50.
Price falls below VWAP.
Bullish MA becomes ghost.
Long Health falls from 100% to 75% or 50%.
One lost factor is not necessarily an exit. It is a warning that confluence is decreasing.
Strong long invalidation
More serious invalidation can include:
Bearish Shift
Bearish Match
Bullish MA break
Price remaining below VWAP
RSI remaining below 50
Bullish FVG support being fully mitigated
Staying in a short
A short remains healthier while:
Latest Shift remains bearish.
Bearish MA remains active.
Price remains below VWAP.
RSI remains below 50.
Short Health remains high.
Bearish FVGs above price act as resistance.
No Bullish Shift appears.
Strong short invalidation
Potential invalidation includes:
Bullish Shift
Bullish Match
Bearish MA break
Sustained price above VWAP
RSI above 50
Bearish FVG resistance being invalidated
18. Stop-Loss and Profit Management
The indicator does not place stops or targets.
Possible stop references include:
For long trades
Below the retest candle low
Below the latest confirmed swing low
Below the bullish FVG
Below the bullish MA with an ATR buffer
Below the structure level that would invalidate the setup
For short trades
Above the retest candle high
Above the latest swing high
Above the bearish FVG
Above the bearish MA with an ATR buffer
Possible profit references
Previous swing high/low
Opposing FVG
Major VWAP deviation area
Fixed risk-to-reward target
Partial exit at 1R and trailing remainder
Opposite Shift
Health score deterioration
Stops should not be moved farther away simply to avoid accepting a loss.
19. Alerts
The script provides selectable conditions for:
Bullish Shift Created
Bearish Shift Created
Bullish Directional MA Retest
Bearish Directional MA Retest
Bullish Pivot MA Broken
Bearish Pivot MA Broken
Bullish Shift + Bullish MA alignment
Bearish Shift + Bearish MA alignment
Alert toggles
The shift and retest alerts have individual enable/disable inputs.
These settings control whether the corresponding alert condition can trigger.
Important TradingView behavior
Enabling an alert condition in the indicator settings does not automatically create a TradingView alert.
You must still:
Open TradingView’s alert dialog.
Select the indicator.
Select the desired alert condition.
Choose the frequency.
Create the alert.
For confirmed signals, using Once Per Bar Close is generally the most consistent choice.
20. Repainting and Confirmation Considerations
Pivot delay
Confirmed pivots require future right-side bars.
This means:
Pivot signals are delayed.
Once confirmed, the historical pivot itself is stable.
The indicator does not know a pivot at the exact moment the pivot bar first forms.
Bar-close confirmation
Confirm Signals On Bar Close is enabled by default.
This reduces intrabar signal changes for:
MA breaks
Structure breaks
Shift creation
Retests
Intrabar movement
The current MA, VWAP, RSI, and live candidate values may still visually move while the current candle is forming.
Using bar-close confirmation does not freeze the current bar’s underlying price calculations.
FVG evolution
FVGs can disappear when:
Mitigated
Invalidated
Removed by overlap filtering
Excluded by the Show Last setting
This is normal lifecycle behavior, not necessarily historical repainting.
21. Practical Decision Hierarchy
A disciplined way to use the indicator is:
Step 1 — Identify structure
Check Latest Shift.
Bullish Shift → prioritize long ideas.
Bearish Shift → prioritize short ideas.
Waiting → insufficient shift history.
Step 2 — Confirm the directional MA
Check Shift + MA.
Bullish Match → bullish structure and MA agree.
Bearish Match → bearish structure and MA agree.
No Match → wait or reduce conviction.
Step 3 — Check equilibrium
For longs:
Prefer price above VWAP.
Prefer RSI above 50.
For shorts:
Prefer price below VWAP.
Prefer RSI below 50.
Step 4 — Check location
Use:
Directional MA retest
FVG support/resistance
Recent swing levels
VWAP
A good directional idea entered at a poor location can still have poor risk-to-reward.
Step 5 — Check health
75–100%: favorable confluence
50%: mixed
0–25%: weak for that direction
Step 6 — Define invalidation before entry
Determine:
Stop level
Position size
Maximum acceptable loss
First target
Conditions for partial or full exit
Disclaimer
This indicator is provided for informational, educational, and analytical purposes only. It does not constitute financial advice, investment advice, trading advice, a solicitation, or a recommendation to buy or sell any financial instrument.
Market-structure shifts, moving averages, VWAP, RSI, Fair Value Gaps, retest markers, continuation symbols, health scores, and alerts are mathematical interpretations of historical and real-time market data. They do not guarantee future price movement or profitable outcomes.
The Health Score is a count of aligned indicator conditions. It is not a probability of success, an expected return, or a measure of actual trade risk.
Trading cryptocurrencies, forex, commodities, futures, CFDs, and other leveraged products involves substantial risk and may result in the loss of some or all invested capital. Historical performance does not guarantee future results. Signals may be delayed because of pivot confirmation, and real-time values may change before a candle closes.
Always perform independent analysis, use appropriate position sizing, define a stop-loss before entering a trade, account for fees and slippage, and never risk capital you cannot afford to lose. The user remains solely responsible for all trading and investment decisions. Indicator

ICT Kill Zones and Session High LowICT Kill Zones and Session High Low
What it does
This indicator draws the intraday sessions as boxes with their high and low, marks the three daily opening levels, and reports which time state the chart is currently in. Its point is not the feature list, which you can find elsewhere; its point is being right at the edges. Everything is anchored to New York wall-clock time, so the sessions keep their place through every daylight-saving changeover, including the weeks when the United States and Europe have not both switched yet. On those weeks the panel says so.
How it works
Every window is resolved through the named time zone America/New York rather than a fixed offset, the chart time zone or your local time. That single choice is what makes the boxes sit correctly in March and October, and it is the reason a session cannot drift by an hour without anyone noticing.
A session starts on the first bar that falls inside its window, not on a bar whose clock reads exactly the start time. On a 45 minute chart no bar lands on 07:00, and a script that waits for one draws nothing that day.
While a session runs, its box grows and its high and low move with it. That state is drawn with a dashed border, because a level that can still change must not look like one that cannot.
When the session ends, the high and low are fixed and never move again. The border turns solid and the two levels extend to the right.
The bar that ends a session can already trade through what that session just fixed, so both things are allowed to happen on the same bar. A level that was taken immediately is never shown as untouched first.
A level is taken when price trades strictly beyond it, by wick or by close depending on the setting. A value exactly on the level is not a take, and each level changes state only once.
The New York to London offset is recalculated per trading day from the calendar itself. It is displayed, never applied: the sessions sit right because they are anchored to New York, not because anything is shifted.
Short trading days and holidays are read from the bars that exist, not from a stored calendar that would need maintenance and would eventually be wrong.
How to use it
Add the script to an intraday chart. Sessions cannot be resolved above 60 minutes, and on higher timeframes the script says so instead of drawing something misleading.
Read the dashed box as the session in progress and the solid one as finished. The two lines running to the right are the finished session's high and low.
Watch the panel in March and late October. When it reads 4h instead of 5h, the two regions are out of step and the London session sits an hour away from where it was the week before. The gap can last up to three weeks in spring and about a week in autumn, depending on the year.
If a day reads Early close or No RTH session, that day was short or closed. Both are recognised after the day is over, so the label refers to the last completed day.
Inputs
Sessions group - one row per session with a switch, its start and end time in New York wall-clock time, and its colour. London Close is off by default so the standard chart shows four boxes that do not overlap.
Session Levels group - show the fixed high and low, extend them to the right, and choose whether a wick or a close counts as taking them.
Time Markers group - Midnight Open, True Day Open and RTH Open, each switchable. The last two are hidden automatically where they have no meaning. Extend Markers Right lets the newest marker of each type run past the latest candle so its line and label stay visible in front of the price action; range 0-500, default 10. Older markers still end where the next marker of the same type begins.
Level Line Style and Marker Line Style - solid, dashed or dotted. The markers are dotted by default so they read as references rather than as structure.
Label Background - off by default, so only the label text shows. Turn it on where a label sits over the candles and the bare text is hard to read.
Days Retained - how many trading days stay drawn, the current one included. Range 1-10, default 2. Older days are deleted, not hidden. On futures the Sunday evening open counts as its own day, so on a Monday the default keeps Sunday and Monday rather than Friday and Monday.
Display group - session labels and where they sit: Above Box by default, Inside Box or Below Box, always centred on the width of the box. Plus text size in points, the time state panel and its corner.
Style group - how far the boxes fade for finished and running sessions, line widths, and one colour per time marker.
Alerts group - each of the four alert conditions can be switched off.
Signals and alerts
Session opened - fires on the first closed bar of a tracked session. Off by default, because the clock is not news.
Session closed - fires when a session has ended and its levels are fixed. Off by default for the same reason.
Session high taken and Session low taken - fire when price trades through a fixed level. On by default, because this is the one event of the four that is not predictable from a clock.
All four fire on the close of the bar that produced the change, and each level can only be taken once.
Repainting
Sessions start, end and levels are taken only on closed bars. A running session is the one thing that changes while it runs, and that is its purpose rather than a defect: its box grows with each bar and is drawn with a dashed border to say so. Once a session is finished its box and its two levels are fixed and are never rewritten, and the offset shown in the panel changes nothing that is already on the chart.
Limitations
A short trading day or a holiday is recognised only after the day is over, because it is read from the bars that exist rather than from a stored calendar. The panel therefore reports the last completed day. On futures that means a short Friday is reported during the Sunday evening session and is replaced once Monday begins.
Sessions need an intraday timeframe. Above 60 minutes the windows cannot be resolved and nothing is drawn.
On instruments without a regular trading session - spot forex, crypto and CFDs - the True Day Open and RTH Open markers are hidden because they are not defined there. The panel says so.
Only the most recent day's time markers carry a label. Older ones keep their line but would otherwise stack their labels on the same spot at the right edge.
A session with no bars inside its window produces nothing at all, which is correct but means an empty session leaves no trace to explain itself.
Days Retained set to 1 together with a window you moved across midnight keeps only the session that is still running. Its completed form is never shown, because the day it belongs to is already outside the retention. Raise Days Retained to 2 if you want to see it finished.
Only the bars of the chart timeframe are used. There is no higher timeframe layer, no intrabar data and no volume.
The script describes when things happened and whether a level was traded through. It does not compare sessions, rank them, or suggest entries, exits or targets.
This script is a charting tool for educational purposes. It does not provide financial advice and does not predict future price movement. Trading carries risk; decisions and their outcome remain yours. Indicator

RC Tools - Divergence DetectorRC Tools — Divergence Detector
────────────────────────────────────────────────────────────────────
█ OVERVIEW
Most divergence tools pattern-match swing highs and lows, which is finicky and often technically repaints — pivots can un-confirm as new bars form. This tool instead measures rolling correlation between price and a momentum oscillator of your choice. When price and momentum stop agreeing, that disagreement is the divergence — measured continuously, not detected as a one-off pattern.
█ WHAT IT DOES
Plots the rolling correlation between price and a selectable oscillator (RSI, MACD line, Rate of Change, or a custom source) on a -1 to +1 scale. Classifies each confirmed bar into one of three states — Confirmed Trend, Bearish Divergence, Bullish Divergence — colours the chart background accordingly, and shows a table with the current state, how long price has been in it, and historical base rates (average forward return and win rate) for each divergence state.
█ THE THEORY BEHIND IT
A genuine trend has price and momentum moving together — new highs accompanied by strengthening momentum, new lows by weakening momentum. When that relationship breaks down — price continues in one direction while the oscillator stops confirming it — that is a divergence. Rather than searching for specific swing-point patterns (which depend on exactly which pivots you pick and can shift as price continues), this tool asks the more direct statistical question: over the last N bars, how closely have price and the oscillator actually moved together? A strong positive correlation means they agree. A correlation that has dropped toward zero or negative means they have stopped agreeing, regardless of what any single pivot looks like.
█ HOW IT IS CALCULATED
1. Compute the selected oscillator: RSI, MACD line (fast EMA minus slow EMA), Rate of Change %, or a custom source you provide.
2. Compute the rolling Pearson correlation between price (close) and the oscillator over a configurable window (default 14 bars).
3. If that correlation falls below a threshold (default 0.0), price and momentum are no longer confirming each other — a divergence state.
4. The divergence is labelled Bearish if price has been rising over a short lookback (momentum failing to confirm continued strength) or Bullish if price has been falling (momentum failing to confirm continued weakness).
Classification occurs ONLY on confirmed bar close — the state and the displayed correlation are computed and committed together, so they can never disagree mid-bar or flip back and forth as the current bar forms.
█ SETTINGS & CONFIGURATION
• Oscillator (default RSI) — RSI / MACD Line / Rate of Change % / Custom Source
• RSI / MACD / Rate of Change lookbacks (defaults 14 / 12+26 / 20)
• Correlation Window (default 14 bars) — how far back the co-movement is measured
• Divergence Threshold (default 0.0) — the correlation level below which price and momentum are considered to have stopped agreeing
• Price Direction Lookback (default 5 bars) — used only to label a divergence bullish or bearish
• Forward Return Window (default 20 bars) — the horizon used for the base-rate table
• Paint Main Chart Background — toggle off if you only want the correlation pane
█ HOW TO USE IT
Use it as a warning flag on an existing trend read, not as a standalone entry signal. Example: if you're long into a rally and the background flags Bearish Divergence, that's a cue to tighten risk management or look for confirmation elsewhere before assuming the move continues unchecked — it is not, by itself, a sell signal. Check the base-rate table's sample count before treating any single divergence reading as meaningfully predictive.
Works on any asset and timeframe with sufficient history for the correlation window.
█ LIMITATIONS
• Divergence describes a PRESENT disagreement between price and momentum. It does not predict a reversal, and any use of it as a forecast is a misuse.
• Correlation is measured over a rolling window and is noisy by nature — expect it to cross the threshold repeatedly in choppy, range-bound conditions.
• The oscillator itself is not plotted, only its correlation with price — this keeps the pane on one consistent scale regardless of which oscillator is selected (RSI is bounded 0-100, MACD line is unbounded, etc.).
• The bullish/bearish label depends on a short price-direction lookback, which can flip near genuine turning points independently of the correlation reading itself.
• Historical base-rate stats need a meaningful sample count (check N) before being trusted, especially for less common states.
• This script does NOT repaint. All classification updates on confirmed bar close only.
█ DISCLAIMER
For educational and informational purposes only. Nothing here is financial advice. Past behaviour of any divergence state does not indicate future results. Trade at your own risk.
Indicator

Strategy

MICRO SOM What this is
A Kohonen Self-Organizing Map that learns market structure from scratch, with no labels, no backpropagation, and no predefined regimes. It builds a topological map of every market condition it has observed, then shows you where the current bar sits on that map.
This is unsupervised competitive learning — a fundamentally different approach from the neural networks usually seen on TradingView. Nothing here is trying to predict direction. It is trying to organize market states, and any predictive read is a byproduct you interpret afterward.
How it works
Each bar is encoded as a five-dimensional vector: distance from VWAP, trend-versus-chop efficiency, volatility state, relative volume, and momentum. All five are ATR-normalized so the map transfers across instruments.
Thirty-six nodes arranged in a 6×6 grid compete to be nearest that vector. The closest node wins — and critically, the winner and its grid neighbors shift toward the input, weighted by a Gaussian falloff.
That neighbor update is the entire mechanism. It forces adjacent nodes to represent similar market states, which is what turns 36 independent clusters into a genuine map. Remove it and this is just k-means.
The neighborhood radius decays over training. A wide radius early establishes global topology; a narrow radius later refines local detail. A fixed radius either never organizes or freezes into a poor layout within the first hundred bars.
The map trains on every confirmed bar. Filtering samples would distort the density it exists to represent.
Reading the display
A 6×6 grid renders to the right of price:
Teal — states that historically preceded upward movement
Red — states that preceded downward movement
Gray — neutral or insufficiently visited
Brightness — visit frequency and directional consistency
White border — the node matching the current bar
Watch the highlighted cell move. That is the market traversing learned state space in real time.
BIAS shows the average forward move that historically followed from the current node, in ATR units. This is measured after clustering, not optimized for — the map organized blind, then the script asked what tended to follow from each region.
NOVELTY is the Euclidean distance from the current bar to its nearest node. When it exceeds the 90th percentile of its own recent history, the chart tints orange and a diamond prints. This means current conditions resemble nothing the map has learned.
Why novelty may be the most useful output
Threshold rules cannot tell you when they are outside their domain. This can. An ALIEN reading is a direct signal that historical analogues are unavailable — typically the moment other models are least reliable and position size should be smallest.
Settings
Learn — adaptation rate. Higher adapts faster but organizes less stably.
Radius — initial neighborhood width. Larger enforces smoother global topology.
Decay — bars over which learning rate and radius anneal toward their floor.
Grid X / Grid Size — map placement and cell height in ATR units.
Honest limitations
The map requires roughly 1,200 bars to organize meaningfully. Before that, the topology is still unfolding and bias values are noise.
BIAS is a historical average, not a forecast. A node showing +0.4 ATR means bars in that region tended upward — it says nothing about the sample size behind that average or whether the relationship persists.
Five features cannot capture everything that matters. The map organizes what it is shown, and no more.
This is an analytical and visualization tool. It produces no entry or exit signals, and it is not financial advice.
Open source. The full algorithm is readable in the code, with the competitive learning step, neighborhood update, and radius annealing documented inline. Indicator

Indicator

Key Levels - Cash MarketThis is a Pine v6 modernization of the original SpacemanBTC Key Levels indicator. The original was already a useful way to keep important higher-timeframe levels on chart, but parts of the session logic, timezone handling, and display system were showing their age—especially for equities and index futures traders.
This version keeps the same core idea while rebuilding the underlying logic for cleaner, more reliable behavior.
What changed
Updated to Pine Script v6
Modernized the codebase and removed a large amount of repetitive legacy plotting logic.
Cash-market sessions instead of FX-style sessions
London, New York, and Tokyo now use their actual local cash-market hours rather than generic FX session windows.
Timezone-aware session handling
Sessions use Europe/London, America/New_York, and Asia/Tokyo, so daylight-saving changes are handled automatically.
More reliable session High / Low / Open levels
Session tracking was rebuilt to reset from the actual first bar of each session, avoiding incorrect levels caused by gaps, stale values, or RTH-only charts.
Improved Tokyo handling
The Tokyo range accounts for the exchange's midday lunch break while preserving the morning range into the afternoon session.
Non-repainting Current Year levels
Current Year High, Low, and Mid were rewritten to avoid higher-timeframe lookahead behavior that could make historical levels differ from what was available in real time.
Improved Monday Range for futures
Uses TradingView's trading-day logic so overnight futures sessions—such as NQ beginning Sunday evening—are correctly associated with Monday.
Simplified display controls
The old Distance and Anchor Distance controls were replaced by a single Right Offset setting. Right Anchored mode now simply starts levels at the current bar.
Cleaner session settings UI
Each cash session now has its enable toggle, session time, and color on the same row.
Global Coloring is now truly global
London, New York, and Tokyo session levels now respect the Global Coloring setting as well.
Based on the original Key Levels SpacemanBTC IDWM source. The original source credited @sbtnc for the base code. This version remains open source with credit to the work it was built from.
Indicator

Liquidity Shift PulseIs a price-structure and liquidity-based overlay indicator designed to identify selected bullish transition and expansion conditions, then manage the resulting long-side state using protected market structure.
The indicator is built around price behavior, confirmed swing structure, volatility normalization, participation, and market-regime conditions. It does not use moving-average crossovers, RSI, MACD, or ADX as signal generators.
1. Purpose
LSP is intended to help traders visually study two different types of bullish price behavior:
Liquidity Shift Entry
Looks for a downside liquidity sweep followed by a reclaim, bullish displacement, and a break of internal price structure.
Expansion Entry
Looks for a strong bullish breakout from an established price range when candle expansion, participation, and market-regime conditions support the move.
These two engines serve different purposes. The liquidity engine focuses on transitions that begin around previously confirmed swing liquidity, while the expansion engine allows the indicator to recognize strong directional breaks even when no recent liquidity sweep is present.
2. Liquidity Shift Logic
The indicator tracks confirmed swing highs and swing lows using pivot-based structure.
For a bullish liquidity setup, price must first trade below a previously confirmed swing low by a configurable ATR-normalized amount and then reclaim that level. The candle must also show sufficient lower-wick rejection.
After the sweep, the script stores the relevant internal structure level and waits for bullish confirmation within the configured setup window.
Confirmation requires several elements:
A valid liquidity sweep and reclaim.
Bullish candle displacement.
Minimum candle range relative to ATR.
Minimum candle-body proportion.
Strong closing location within the candle.
A close above the stored internal structure level.
Optional relative-volume confirmation.
Optional market-regime confirmation.
A setup that becomes too old or moves materially below its sweep low is invalidated.
3. Expansion Entry
The Expansion Entry engine is designed for a different market condition.
Instead of requiring a prior liquidity sweep, it looks for price to close above the highest high of a configurable previous range.
The breakout candle must meet configurable requirements for:
Breakout distance.
Range expansion relative to ATR.
Candle-body proportion.
Closing strength.
Relative volume, when available and enabled.
Market-regime conditions.
The Expansion Entry can be disabled independently from the liquidity-shift engine.
4. Participation Filter
LSP can compare current volume with a previous rolling volume baseline.
The resulting relative-volume measurement can be used to prevent an entry condition from being accepted when participation is below the selected threshold.
If usable volume data is unavailable for the symbol, the script does not treat missing volume as automatic confirmation failure.
5. Market Regime Filter
The optional regime filter uses a Choppiness Index calculation to distinguish more directional conditions from highly compressed or irregular environments.
The filter can accept either:
A sufficiently directional market, or
A market whose choppiness is decreasing while remaining below the configured transition threshold.
This component is used as a contextual filter rather than as an independent trading signal.
6. Protected Structure
After a BUY condition is confirmed, LSP establishes a Protected Structure level below price.
As new confirmed higher pivot lows form after entry, this protected level can move upward.
An important design characteristic is that Protected Structure is one-directional during an active long state:
It can move higher, but it does not move lower.
This creates a visual representation of the price structure that the active bullish condition is attempting to preserve.
7. SELL / Exit Logic
The SELL label in LSP represents an exit from an active long-side state, not an independent short-entry signal.
A SELL can occur when one of the following conditions is confirmed:
Price closes below Protected Structure.
A bearish liquidity reversal develops after sufficient favorable movement.
A large established move gives back more than the configured percentage of its maximum open favorable excursion and receives bearish candle confirmation.
Because SELL conditions are evaluated only while the script is in an active long state, users should not interpret SELL labels as standalone short recommendations.
8. Large-Trend Protection
For unusually extended favorable moves, the script tracks:
Entry price.
ATR at entry.
Highest price reached since entry.
Maximum favorable movement.
Current remaining favorable movement.
Percentage of the maximum move that has been given back.
Once the move exceeds the selected ATR activation threshold, the optional profit-protection logic can react to excessive giveback accompanied by bearish price behavior.
This feature is intended as structural protection logic rather than a profit target.
9. Main Settings
The script provides controls for:
Liquidity Engine
Pivot sensitivity
ATR period
Minimum sweep penetration
Minimum rejection wick
Structure Shift
Internal structure length
Setup memory
Structure-break buffer
Displacement range
Candle-body strength
Closing strength
Setup invalidation
Expansion Entry
Enable/disable expansion entries
Breakout lookback
Breakout buffer
Expansion range
Body requirement
Closing strength
Participation
Relative-volume filter
Volume baseline
Minimum relative volume
Market Regime
Choppiness filter
Choppiness period
Directional threshold
Transition threshold
Exit Protection
Initial structure buffer
Higher-low protection buffer
Bearish reversal activation
Large-trend activation
Maximum profit giveback
Visuals
Protected Structure
Confirmed liquidity levels
Liquidity sweep markers
BUY/SELL labels
Signal distance from price
10. Alerts
Alert conditions are included for:
Bullish liquidity sweep
Liquidity-shift BUY
Expansion BUY
Combined BUY
Bearish liquidity shift
SELL
Users can create TradingView alerts from these conditions according to their own workflow.
11. Confirmation and Repainting Behavior
LSP evaluates its principal signal conditions on confirmed bars.
Swing liquidity levels are based on confirmed pivot highs and pivot lows. Because pivot confirmation requires bars to form to the right of the potential swing, these levels inherently appear with confirmation delay.
This is intentional: a swing is not treated as confirmed before the required right-side bars exist.
The script does not use future-looking data or lookahead logic to generate historical signals. Once a BUY or SELL event has been confirmed on a closed bar, the script does not intentionally relocate that historical signal.
Users should distinguish this from normal real-time chart behavior: values and conditions on the currently open candle can change until that candle closes.
12. How to Use
LSP is best interpreted as a structured market-analysis framework, rather than as a standalone mechanical trading system.
Possible uses include:
Identifying liquidity-reclaim transitions.
Identifying strong structural expansion events.
Monitoring whether a bullish structure remains intact.
Visualizing progressively higher protected structure.
Creating alerts for selected liquidity and structural events.
Combining LSP with a trader's own risk management, higher-timeframe analysis, and broader market context.
Different markets and timeframes have different volatility and liquidity characteristics, so the default parameters should not be assumed to be optimal for every instrument.
13. Design Approach
The script combines several price-action concepts for a specific workflow rather than simply stacking unrelated indicators.
Its sequence is designed around:
Liquidity interaction → reclaim → displacement → structure confirmation → protected structure management
with a separate expansion path for strong structural breakouts.
The purpose of combining these components is to distinguish initial bullish qualification from subsequent structure management and exit conditions within one consistent state model.
14. Limitations
Liquidity Shift Pulse is an analytical indicator, not a strategy or automated trading system.
It does not predict future prices and does not guarantee that a liquidity sweep, breakout, BUY, SELL, or protected-structure event will lead to a profitable outcome.
Important limitations include:
Pivot-based swing detection introduces confirmation delay.
Strong trends can produce false breakouts.
Liquidity sweeps can fail after reclaiming a level.
Choppy markets can create repeated structural transitions.
Volume quality varies between instruments and data sources.
ATR normalization adapts measurements to volatility but does not make different markets behaviorally identical.
Protected Structure is a price-structure reference, not a guaranteed stop level.
Historical observations do not establish future performance.
The indicator should therefore be used together with independent analysis and appropriate risk management. Indicator

Zebra Grid & Time VerticalsThis indicator provides dynamic price-shelf visual scaffolding and multi-timeframe session timing using non-cluttering overlays.
Dynamic Centered Horizontal Grid: Calculates a dynamic centerPrice rounded to the user-defined point step (e.g., 10 or 100 points) and tracks upper/lower boundary triggers. When price expands outside the current range boundary, the entire grid dynamically shifts to re-center around live price action.
Zebra Interval Shading: Draws alternating background filled boxes (box.new) between even step intervals alongside persistent horizontal price lines (line.new), giving immediate visual definition to price bins across the chart space.
Historical Timeframe Markers: Detects period transitions (ta.change(time(tf_input)) != 0) on a user-designated higher timeframe (e.g., 15m or 6h) and plots full-chart-height vertical lines at each interval open.
Forward (+1) Projection Line: Requests higher timeframe closing timestamps via request.security to project a future vertical line (lineFuture) using xloc.bar_time to show precisely where the next interval will start before it arrives.
Memory Management: Operates exclusively on barstate.islast using arrays (gridBoxes, gridLines) to purge and redraw horizontal elements, keeping line counts clean within standard TradingView script limits (max_lines_count=500).
How to Use It in Trading:
Intraday Execution (Left 1m Chart): Set step sizes to 10 points with 15-minute vertical lines. Use the alternating zebra bands as visual target shelves for scalping micro-swings, and monitor the 15-minute vertical lines to anticipate volatility shifts around candle opens/closes.
Macro Structure (Bottom-Right 30m Chart): Set step sizes to 100 points with 6-hour (360m) vertical lines. The 100-point bands map institutional round-number zones, while the 6-hour vertical intervals visually segregate the trading day into four distinct structural sessions (Asia, London, US Morning, US Afternoon).
Session Timing & Preparation: Use the +1 Future Vertical Line to pre-plan trade execution windows, identifying exactly how much time remains in the current higher-timeframe candle before structural resets occur.
Other Script Features
Independent Modular Toggles: Dedicated user inputs (showZebra, showVerts) allow instantaneous toggling of horizontal price grids and vertical time lines without removing the script.
Custom Styling Options: Complete user control over horizontal step sizes, grid line counts, line styles (Solid, Dashed, Dotted), line widths, and fill color transparency. Indicator

Indicator

Matrix Risk/RewardMatrix Risk/Reward is a visual trade-planning overlay. Click three points on the chart (entry, stop, target), then drag them. The script converts those prices into dollar risk, dollar reward, tick distance, risk/reward ratio, and live open P&L for the size you set.
It does not read your broker or prop-firm order ticket, and it does not place, modify, or cancel orders. The three points are planning levels you control.
HOW TO USE
1. Add the indicator to the chart.
2. Click Entry, then Stop, then Target.
3. Set Size to your contracts, lots, or units.
4. Click the indicator on the chart so the three points light up, then drag those points, not the dashed rays.
5. Read dollar SL/TP on the labels and in the table.
Direction is detected automatically: stop below entry = long, stop above entry = short. Stop and target must sit on opposite sides of entry for a valid R:R.
WHAT IT SHOWS
- Stop loss in dollars and ticks
- Take profit in dollars and ticks
- Open P&L in dollars
- Reward-to-risk ratio
- Dollars per tick
- Bid / ask / spread when a quote mode is active
- Colored risk and reward zones
OPEN P&L QUOTE
Last +/- spread (default, all plans): bid = last minus half spread, ask = last plus half spread. Longs mark to bid. Shorts mark to ask. Set Spread (ticks) to your market (1 is typical for MES, MNQ, ES, NQ).
Last price: uses the chart close only.
1-tick bid/ask (Ultimate): uses live 1-tick bid and ask. Requires a TradingView Ultimate plan. If those quotes are missing, it falls back to Last +/- spread.
POINT VALUE
Dollar math is price move x point value x size.
Leave Point value override at 0 to auto-detect common futures (MNQ 2, MES 5, NQ 20, ES 50, YM 5, RTY 50, GC 100, MGC 10, CL 1000, MCL 100, MYM 0.5, M2K 0.5). For other symbols the script uses the chart's built-in point value. If dollars look wrong, set the override yourself.
SETTINGS
Position: Size, point value override, open P&L quote mode, spread in ticks.
Levels: Draggable entry, stop, and target.
Display: Table, zone colors, and zone transparency.
NOTES
This is a calculator overlay, not a strategy and not a broker bridge.
If you want the dollars to match a live ticket, drag this tool onto those prices.
1-tick bid/ask is optional. Leave the default quote mode on unless you have Ultimate.
Not financial advice. Size, point value, and spread must match the instrument you are trading. Indicator

Jackson Hole Symposium [NQTrades]Jackson Hole Symposium
This indicator highlights the historical dates of the Jackson Hole Economic Policy Symposium directly on the chart.
The Jackson Hole Symposium is one of the most closely watched annual central banking events, bringing together policymakers, economists, academics, and financial market participants. Speeches and comments from Federal Reserve officials during the event can generate significant volatility across equities, bonds, currencies, and other financial markets.
Features
Highlights the full Jackson Hole Symposium period directly on the chart.
Includes historical editions from 2020 to 2026.
Differentiates the 2020 and 2021 virtual editions from regular symposiums.
Optional background highlighting.
Optional vertical lines marking the start and end of each symposium.
Optional labels identifying each edition.
Fully customizable colors.
Manual option to add a future Jackson Hole edition without modifying the code.
Alerts available for the start and end of the symposium period.
All event times are handled using New York time for consistency with U.S. financial markets.
Purpose
The indicator is designed as a market context tool, allowing traders to quickly identify how price behaved before, during, and after previous Jackson Hole Symposiums.
It can be particularly useful for studying volatility, liquidity, directional expansion, reversals, and market reactions around major Federal Reserve communication events.
The indicator does not generate buy or sell signals. It is intended to provide historical and contextual information to complement your own trading analysis.
Developed by NQTrades. Indicator

Sattam | Gann ToolsSATTAM | GANN TOOLS - a complete Gann geometry toolkit on two clicks
Four independent Gann constructions, all built from a single anchor you place
yourself: the Cycle Star, the Gann Grid, four Gann Fans, and tiling Gann
Squares. Each turns on or off without disturbing the others.
=== HOW TO PLACE IT ===
Add the indicator and it asks for two points:
1. THE ANCHOR - one click sets both the starting price and the starting date.
2. THE FIRST LEVEL DATE - one click sets the time unit.
Everything else is derived. The gap between the two clicks becomes the box's
time unit, and the starting price becomes the head of the cycle.
=== THE CORE IDEA: THE CYCLE LIVES IN SQUARE-ROOT SPACE ===
The cycle's reach is measured in the SQUARE ROOT of price, not in price:
end = ( sqrt(startPrice) +/- 2 * sqrt(Space) * totalDegrees / 360 ) ^ 2
With Space = 100 one full turn spans exactly 20 units of sqrt(price). Because
the travel is linear in the root, the price gaps compress as price falls and
open up as it rises - the Square-of-Nine behaviour Gann worked in.
Space is the only input that sets the reach:
2*sqrt(50) = 14.1421
2*sqrt(100) = 20.0000
2*sqrt(200) = 28.2843
=== CYCLE SHAPE: A POLYGON'S ANGLE SUM ===
Cycle shape decides how far around the cycle travels and in how many steps.
Each polygon is walked in 2n steps covering its interior angle sum,
(n-2)*180, so a single step is (n-2)*90/n:
SHAPE SIDES STEP STEPS TOTAL SWEEP
Triangular 3 30 6 180
Circular / Square 4 45 8 360
Pentagon 5 54 10 540
Hexagon 6 60 12 720
Heptagon 7 64.2857 14 900
Octagon 8 67.5 16 1080
Nonagon 9 70 18 1260
Decagon 10 72 20 1440
Straight line - 90 4 360
Custom - your Angle derived derived
The root-space reach scales with the total sweep, so a Decagon travels four
whole turns and reaches four times as far as a Circular cycle. Circular and
Square are the same figure - both are the four-sided case.
Custom takes its step straight from the Angle input: set 60 and you get a
Hexagon; leave it at 0 and it falls back to 45.
=== ANGLES, SECONDARY ANGLES AND TIME LEVELS ===
Two ways to distribute the levels:
Calculate Angles by Averages ON
Levels spaced EQUALLY IN PRICE. Even ladder, constant gaps.
Calculate Angles by Averages OFF
Levels spaced EQUALLY IN SQRT(PRICE). The gaps shrink steadily as the
cycle descends and grow as it rises - the truer Gann reading.
Main and secondary levels alternate by index: even-numbered levels take the
main style and colour, odd-numbered ones the secondary. Draw Secondary Angles
hides the odd ones on their own.
TIME DIVISIONS - the box is (steps / 2) units wide.
- Solid time levels on 0, 1/4, 1/2, 3/4, 1 of the width.
- Dashed levels on 1/2 +/- {1/10, 1/6, 1/4, 3/10, 1/3} - the very same five
fractions the price levels use, mirrored about the middle of time instead
of the middle of price.
=== THE STAR ===
The signature figure: the box frame, its mid vertical and mid horizontal, and
FOURTEEN diagonals - corner to opposite corner, corner to the far side's
middle, corner to the mid vertical's opposite end, and the mid vertical's ends
back to both side middles. Twenty lines that mark every internal crossing of
the range.
INTERNAL PRICE LEVELS - five pairs mirrored about the box centre at
1/10, 1/6, 1/4, 3/10 and 1/3 of the span, drawn dotted with their prices
labelled. The quarter pair lands exactly on the 90 and 270 degree levels.
=== THE GANN GRID ===
Full grid
Main channel
A 4 x 4 lattice over the box: the time quarters against the price quarters,
which are the 0/90/180/270/360 degree levels. Every cell carries both of its
diagonals - 32 lines, and nothing else; the grid draws no frame of its own.
Draw only main channel keeps the 1x1 band alone: the diagonal cells keep both
diagonals, the cells directly above and below keep the main one. Fourteen
lines instead of thirty-two.
=== THE GANN FANS ===
1st fan
2nd fan
3rd fan
4th fan
All four
Extra Angles
Extend
A fan from any of the four corners of the box, each on or off independently.
Every fan carries the nine classic Gann angles - 1x8, 1x4, 1x3, 1x2, 1x1,
2x1, 3x1, 4x1, 8x1. Each ratio is drawn as two lines: one crossing the full
width and landing on that fraction of the price span, one crossing the full
span and landing on that fraction of the width. The 1x1 belongs to both
families, so a fan is ten lines.
- Extra Angles adds 5x8, 8x5, 7x8 and 8x7 - four more lines.
- Extend turns the fan into rays that carry on past the box.
=== THE GANN SQUARE ===
One square
Tiled squares
A square of price against time, drawn as the same twenty-line figure the Star
uses, at its own size.
- Box Size is the width in CALENDAR DAYS.
- Height = Box Size x Price Unit.
- Leave Price Unit at 0 and it resolves automatically to one hundred ticks
of the symbol - 10 on a 0.1-tick future, 1 on a 0.01-tick stock.
- Boxes Left / Right / Up / Down tile the identical square in each
direction, so you can carry the grid of squares across the chart.
The square runs the way the cycle runs: down from the anchor on a falling
cycle, up on a rising one.
=== DIRECTION ===
Trend decides which way the cycle travels from the anchor.
- Bullish - up.
- Bearish - down.
- Auto - compares your anchor price with the LAST CLOSE: an anchor above the
market runs down, an anchor below it runs up.
=== EXTENDING THE CYCLE ===
- Extra whole cycle multiplies the walk. On a Circular cycle, 1 takes it
from 360 to 720 degrees and doubles the reach.
- Extra primary angle adds one primary angle - 90 degrees, so two steps. On
a Circular cycle, 1 takes it from 360 to 450 degrees.
- Time space, when set, replaces the First-Level unit with a plain span of
calendar days.
=== STYLING ===
Every family has its own style, width and colour: main angles, secondary
angles, time levels, the star, the star's time levels, the star's price
levels, the grid, the fans and the squares. Label size follows the Size input.
=== NOTES ===
- The two anchor points are interactive inputs. If you edit and recompile
the script, TradingView clears them and asks for the two clicks again.
- The drawing is placed by date, so it keeps the same calendar position
across timeframes.
- On very long sweeps (Decagon, or a large Extra whole cycle) the root can
cross zero and square back up. That is the geometry doing what it is
defined to do, not an error. Indicator

Order Block & Breaker Block ZoneOrder Block & Breaker Block Zone
A strict Order Block detector, and the Breaker Block that a failed Order Block turns into.
Most Order Block tools mark the last opposite coloured candle before a strong move. That
description fits almost any pullback, which is why those tools cover a chart in boxes. This one
asks for four independent pieces of evidence on the same candle before it will draw anything, and then it keeps following the zone for the rest of its life instead of drawing it once and walking away.
The candle's own colour is never checked. Colour is a description of a candle, not evidence about what happened at that price.
WHAT HAS TO HAPPEN
Bullish Order Block
1 The block candle trades BELOW the previous candle's low the sweep
2 That same candle is Candle 1 of a valid three candle bullish imbalance, so Candle 3's low sits above the block candle's high the gap
3 Price does not trade back into the block's high to low range while it is still waiting the zone stays clean
4 A candle CLOSES above the last unbroken swing high the structure break
Bearish Order Block is the same read upside down: the block candle trades above the previous
candle's high, the imbalance runs the other way, and a candle closes below the last unbroken
swing low.
The zone drawn is the block candle's full high to low range.
The structure break also has to land inside a wait window, counted forward from Candle 3. A block that needs fifty candles to break structure is no longer the same story, so the wait is limited and the block is dropped when it expires.
BOS OR CHoCH - A TAG, NOT A GRADE
Market structure is tracked separately, from swing pivots. Each new swing is compared with the
one before it, which gives the familiar higher high, higher low, lower high, lower low reading,
and from that the structure is either bullish or bearish.
A break that runs WITH the structure is a Break of Structure. A break that runs AGAINST it is a
Change of Character, and that is what flips the structure the other way. Mechanically they are
the same event - a close beyond a swing level. Only the direction relative to the current
structure decides the name.
So a Bullish Order Block can arrive in two very different situations, and the label says which:
Bull OB (CHoCH) the market was bearish and this block flipped it a reversal block
Bull OB (BOS) the market was already bullish and carried on a continuation block
Neither ranks above the other. They are different stories, not different quality levels, and the
tag exists so you can tell them apart at a glance instead of reconstructing it from the chart.
THE LIFE CYCLE
A zone is not finished when it is drawn. It is followed until it resolves.
Fresh confirmed and untouched. Drawn in the bullish or bearish colour.
Mitigated price has traded back into the zone. It is no longer a fresh Order Block, so it
is repainted in grey. It is kept because it is what a Breaker grows from.
Breaker Block the zone has failed, with a candle CLOSING through its far side. It flips polarity and is redrawn in the opposite colour. A wick through does not count.
The entry and the failure can land on the same candle. One candle that trades into the zone and closes through the other side takes the block from fresh to Breaker in a single step, and that is treated exactly like a slower failure.
No reaction inside the zone is asked for before a Breaker is drawn, and that is a deliberate
departure from how this is usually done. Where an Order Block is only "the last opposite candle
before a move", a Breaker built on it needs a second proof, because the block itself proved
nothing. That weakness is not present here. A zone only becomes an Order Block after a sweep, and imbalance and a structure break, and a displacement that broke structure IS the evidence that orders were resting at that price. Asking for a reaction on top of it is asking for a second
receipt for the same purchase.
It is also worth being clear about what actually traps a trader. Limit orders fill the moment
price trades into the zone. They are trapped the moment a candle closes through the far side. A reaction candle in between never created that trap - it was only a witness to it, and the absence of a witness does not mean the event did not happen. A proven zone that is overrun without even being allowed to answer is not the weaker case. It is the more one sided one.
WHAT MAKES THIS DIFFERENT
1. Four conditions, not one.
Sweep, imbalance, clean zone and structure break each test something different: that liquidity
was taken, that the move away was violent enough to leave a gap, that nobody has been back, and that the move changed something. Any one of them on its own is common. All four on the same candle is not.
2. Colour is ignored on purpose.
The classic "last opposite candle" case still gets caught, because the candle that sweeps the
previous extreme is usually that candle anyway. It is caught as a consequence of the evidence
rather than as the rule, and the blocks that only ever qualified on colour are left out.
3. The zone is followed, not just marked.
Fresh, mitigated and breaker are three different states, and a zone moves between them as price does its work. What is on the chart is the zone's current condition, not the condition it was in on the day it formed.
4. The Breaker inherits the block's proof instead of asking for a new one.
Because the Order Block had to earn its place, a Breaker built on it does not need a reaction
close to be believed. What is asked for is the one thing that actually matters: a candle body
closing through the far side. That keeps the rule honest in both directions - it does not throw
away a violent one candle break, and it still refuses a wick.
5. Structure is measured, not assumed.
BOS and CHoCH come from confirmed swing pivots that have to be paid for with right hand candles. Nothing is read from a moving average or a fixed lookback window.
6. The evidence is on the chart, not just the claim.
Each block can show the imbalance that qualified it and the swing level whose break confirmed it. You are not asked to take the label's word for it - the gap and the broken level are drawn where they happened, so the block can be checked in a couple of seconds.
READING THE CHART
Green box, "Bull OB (BOS)" or "Bull OB (CHoCH)" fresh bullish Order Block, label below
Red box, "Bear OB (BOS)" or "Bear OB (CHoCH)" fresh bearish Order Block, label above
Grey box, "... mitigated" tapped, waiting to resolve
Green box, "Bullish Breaker" a failed bearish block, polarity flipped
Red box, "Bearish Breaker" a failed bullish block, polarity flipped
Each box spans the Order Block candle's full high to low range, and runs to the right edge while
the zone is still drawn so you can see where price sits against it now.
Two extras are drawn alongside each block:
Dotted yellow box the imbalance that qualified the block. It covers the three candles it formed on and sits directly ON TOP of a bullish zone or directly BELOW a bearish one, because the gap starts where the block candle ends.
Dashed line the swing level whose break confirmed the block. It runs from the swing itself across to the candle that closed through it, so you can see which high or low was taken and how far the move travelled to take it.
Between them these two say why the block exists: the gap is the imbalance test, the dashed line is the structure test. Both are the Order Block's credentials, so both disappear once the zone flips to a Breaker. By then its Order Block life is over and only the level still matters.
A Breaker's box can begin either at the candle that broke the zone or at the original Order Block
candle. The price levels are identical either way - only the left edge moves. Starting at the
breakout is the default, because a Breaker only becomes a Breaker when it flips, and drawing it
from its birth stretches old ones across the entire chart.
A chart can only stay readable if it is not covered in boxes, so only the most recent few zones
of each kind are drawn. Order Blocks - fresh and mitigated together - have their own limit, and
Breaker Blocks have theirs. Everything older is still tracked and can still turn into a Breaker
later, it is simply not on screen.
The corner table counts everything still being tracked: fresh Order Blocks, mitigated zones and
Breaker Blocks, split into bull and bear. It counts zones whose type is switched off and zones
sitting outside the display limits too, so the table describes the record while the chart shows
the recent part of it. If the table reads higher than what you can see, that is the display limit
doing its job.
Two more optional overlays are available for checking the structure engine directly. Swing labels put HH, HL, LH and LL on the pivots, and the structure break markers name every BOS and CHoCH on the chart rather than only the ones that confirmed a block. Both are off by default.
SETTINGS
Market Structure
- Swing Left and Swing Right: how many candles must confirm a pivot on each side. The default of 5 and 5 reads ordinary swing structure. Lower it to 3 and 3 for minor structure and many more breaks; raise it for major structure only. Swing Right is also the confirmation delay - a swing does not exist until that many candles have closed.
- Show Swing Labels (HH / HL / LH / LL): names each confirmed pivot.
- Show Every Structure Break (BOS / CHoCH): draws and names every break on the chart, not only the ones that confirmed a zone.
Order Block
- Scan Length: how many closed candles back the search for new blocks reaches. The running candle is always excluded. This bounds the search, not the structure engine - swings and the bullish or bearish structure state are read from the whole chart, so a block found right at the edge of the window is still measured against everything that came before it.
- Max Order Blocks Shown: how many of the most recent Order Blocks are drawn. Fresh and mitigated zones share this limit. This is the setting to reach for when the chart feels crowded.
- Max Breaker Blocks Shown: the same limit for Breaker Blocks, counted separately.
- Structure Break Wait: how many candles a block may wait for its structure break, counted from Candle 3 of the imbalance. The zone has to stay clean for the whole wait. If the wait runs out the block is dropped.
Zone Types
- A switch for each of the five things that can be on screen: bullish and bearish Order Blocks,
mitigated zones, and bullish and bearish Breaker Blocks.
- Show Order Block FVG: draws the imbalance that qualified each block.
- Show Confirming Swing: draws the swing level whose break confirmed each block.
Zone Style
- Bullish, bearish, mitigated and imbalance colours, fill transparency, and whether drawn zones
extend right. The imbalance is always filled a little lighter than the zone it belongs to, and
neither the imbalance nor the confirming swing is ever extended - both mark where something
happened, not where price is now.
- Breaker Zone Starts At: whether a Breaker's box begins at the Breakout Candle, where the zone actually flipped, or at the Order Block Candle it grew from. Breakout Candle is the default and keeps old Breakers from stretching across the whole chart. The price levels do not change.
Labels
- Show Labels, Label Size, and Label Distance from Zone as a percentage of the zone height.
Increase the distance on noisy charts so labels clear the candles.
Summary Table
- Show, position and size of the corner table.
ALERTS
Six alert conditions:
Bullish Order Block a bullish block has confirmed its structure break
Bearish Order Block a bearish block has confirmed its structure break
Bullish OB Mitigated price has traded back into a fresh bullish block
Bearish OB Mitigated price has traded back into a fresh bearish block
Bullish Breaker Block a failed bearish block has become a bullish Breaker
Bearish Breaker Block a failed bullish block has become a bearish Breaker
Each message carries the event, the symbol, the timeframe and the closing price. The same
messages are also sent through the alert function, so the "Any alert() function call" alert type
can deliver all six through a single alert.
Every alert is evaluated only after a candle has fully closed.
REPAINTING
This script does not repaint.
- The whole engine runs once per closed candle. Price moving inside an open candle cannot create, change or remove anything, and cannot make a signal appear and then disappear.
- Swings are only usable after their right hand candles have closed. That delay is deliberate: it
is what makes a swing a fact rather than a guess. A swing high therefore appears Swing Right candles after the candle it belongs to, and a structure break can only be measured against a
swing that already existed.
- Zones are built forward, one candle at a time, in the same order they would have been built
live. A zone that has been drawn is never moved. Its colour changes when its state changes, and
that is a record of what price did afterwards, not a revision of what it did before.
- Nothing is read from a higher timeframe, so there is no higher timeframe lookahead to get
wrong.
When you create an alert, TradingView may show a caution banner saying the indicator can repaint. That banner appears automatically for any script that uses the built in bar state variables, no matter how they are used, because the platform cannot check the intent behind them. This script uses one of them for the opposite purpose: it is what restricts the entire engine to bar close. Choosing "Once Per Bar Close" when creating the alert is still recommended.
NOTES AND LIMITATIONS
- The pattern is rare by design. Four conditions have to line up on the same candle, so long
stretches with nothing new on the chart are normal. If you want to see more, look at a faster
timeframe rather than loosening the settings.
- A block that is tapped before its structure break lands is dropped rather than confirmed. This
is strict on purpose: an Order Block that has already been traded back into was not untouched
when it confirmed, whatever happened afterwards.
- Swing Right is a real delay. On a very slow timeframe the confirmation of a swing can take a
meaningful amount of time, and a structure break cannot be recognised before the swing it breaks has been confirmed.
- Scan Length and the display limits do two different jobs. Scan Length decides how far back
blocks are looked for at all, so raising it can find older blocks. The display limits only
decide how many of what was found is drawn; raising them shows more of the same set, lowering them hides zones that are still being tracked. Nothing about how a block is detected or how it resolves depends on whether it happens to be drawn.
- An internal cap of 200 tracked zones keeps memory and the drawing count inside TradingView's limits. On a very long history the oldest tracked zones are dropped, so the table describes the recent record rather than the entire chart.
- Detection is purely structural. It reports where these sequences occurred and what state each
zone is in. It does not rank zones by quality, measure follow through, or produce entries,targets or stops.
HOW TO USE IT
A fresh Order Block marks a price where liquidity was taken, the move away left a gap, nobody has been back, and structure changed. Traders commonly watch these areas for:
- A reaction on the first return, since the zone is untouched until then
- Context from the tag, where a CHoCH block sits at a possible turn and a BOS block sits inside
an existing move
- Confirmation against a higher timeframe read, where a block that agrees with the larger picture carries more weight than one that fights it
A grey mitigated zone is a zone that has already been used once. It is worth less as an entry
area and worth more as a warning: it either holds from here, or it becomes a Breaker.
A Breaker Block is the opposite side of the same level. Traders commonly watch the far edge - the low of a broken bullish block, the high of a broken bearish block - on the first return after the flip.
These are reference areas, not entry signals on their own. Use them alongside your own structure read, your own entry method and proper risk management.
DISCLAIMER
This indicator is a pattern detection tool. It is not financial advice and it makes no claim
about profitability. Trading involves risk. Always apply your own analysis and risk management. Indicator

Supply Demand AI [PickMyTrade]Supply Demand AI asks the question every supply/demand tool skips: when price returns to a zone, does this arrival look like the ones that reversed — or like the ones that ate straight through?
Every supply/demand indicator draws the zone. None of them score the arrival. This one does. Each time price re-enters a zone, nine properties of the return are frozen before the outcome is known — approach speed, prior tap count, zone age, departure strength, base tightness, base volume, trend pressure, relative volume and zone width — and the arrival is voted on by a Lorentzian nearest-neighbour search over every similar return this chart has already resolved. The result is stated in the past tense: of the arrivals that looked like this, X% produced the configured reaction move before the zone failed.
The script also scores two doctrines stated everywhere in supply/demand teaching and measured almost nowhere: whether fresh zones genuinely outperform tapped ones on this chart, and whether heavy-volume bases genuinely outperform quiet ones. The info table reports what actually happened, not what the doctrine says should have.
――――――――――――――――――――――――――――――――――――――
🔷 WHAT IT MEASURES
🔸 Zone formation — base-and-departure, not pivot clustering A zone is born from a run of compressed candles (the base) followed by an impulsive leg away of a configurable ATR multiple within a fixed window — the Rally-Base-Drop / Drop-Base-Rally shape, detected as a sequence rather than asserted from a single bar. A pivot cluster has no departure to measure; a base-and-departure zone has three properties frozen at birth that a pivot never carries: how hard the market left, how tight the base was, and which side was trading volume while it sat there.
🔸 Zone geometry The origin block (solid segment) marks the actual base candles. The projection (lighter band) carries those prices forward to where they can be tested. The departure measure (vertical bar on the departure candle) shows the full distance the move reached — readable straight off the price scale. Freshness is written as text ("fresh" / "2 taps"), not encoded in a line style that has to be decoded.
🔸 Outcome — reaction magnitude, not hold-or-break A return that drives the configured ATR multiple back away from the zone edge before closing decisively through it = REACTED. A return that closes beyond the far edge by the break buffer = FAILED. A return that does neither inside the timeout window = STALLED and discarded from training — price sitting inside a zone is not evidence either way.
🔸 Two doctrine read-outs The info table reports the freshness edge (did untouched zones react more often than tapped ones on this chart?) and the base-volume edge (did heavy-volume bases outperform quiet ones?). Either can come back negative, and the table says so when it does.
――――――――――――――――――――――――――――――――――――――
🔷 THE LORENTZIAN NEAREST-NEIGHBOUR CLASSIFIER
🔸 Why Lorentzian, not Naive Bayes A Naive Bayes model was the obvious alternative and is the wrong tool here: it assumes the features are conditionally independent given the class. Departure strength, base tightness and zone width all describe the same underlying impulse from three angles — multiplying their densities counts one piece of evidence three times. A nearest-neighbour vote makes no independence assumption at all. It asks a narrower, more honest question: of the returns already resolved on this chart, what happened to the ones that arrived most like this one?
🔸 Distance metric Distance is Lorentzian — log(1 + |a − b|) — applied per axis and summed. Against a library of this size, plain Euclidean distance lets one outlier axis dominate; the log compresses extremes, so a return that is typical on eight features and unusual on the ninth still finds its true neighbours.
🔸 Shared library — supply and demand in one pool Every feature is written relative to the direction of the test, so a fast approach into demand and a fast approach into supply are the same event described the same way. Sharing one library across both directions doubles the effective sample count without mixing unlike distributions.
🔸 Shrinkage The neighbour vote is shrunk toward the library's own base rate. Without it, k unanimous neighbours read as a certainty the sample size cannot support. The shrinkage weight is expressed in neighbour-equivalents so it is independent of k.
🔸 Honest caveat — stated here, not buried in a tooltip The classifier learns as history replays, so loading a different amount of chart history changes how many returns have trained it and therefore the percentage shown on a zone. The zones themselves, their boundaries and which bars they appear on are unaffected. This is inherent to on-chart learning.
――――――――――――――――――――――――――――――――――――――
🔷 SIGNALS AND DISPLAY
🔸 Zone appearance Full-strength blue (demand) or orange (supply) border at or above the conviction threshold. Muted at the opposite end. Neutral while price is inside — the zone is neither reacting nor failing yet. Grey once consumed. A zone born from twice the required departure draws with a heavier border — the one property worth reading before any text.
🔸 Zone label Nearest live demand, nearest live supply, and any zone with a return open right now receive a worded label: zone type · departure in ATR · evidence grade (A–D) · tap count · classifier read. Every other zone speaks through colour alone, which caps visible labels at roughly three regardless of timeframe or zoom.
🔸 Evidence grade (A–D) Measures accumulated evidence only — departure strength (35%), base tightness (25%), resolved return count (20%), age (20%). Deliberately excludes the classifier's probability so the grade and the percentage remain two different statements: the grade says how much stands behind the zone; the percentage says how similar arrivals resolved.
🔸 Return history ticks A coloured tick inside the zone at every bar where one of its own returns resolved — blue for a reaction, orange for a failure. Renders each zone's individual track record in place so the percentage can be read against the evidence behind it.
🔸 Order flow band A band above the trend EMA while cumulative volume delta is rising, below it while delta is falling. Opacity scales with how strong that pressure is against its own recent range — a faint band means the tape is undecided; a solid band means one side is leaning on it. Context, not a signal: it says which side is pressing when price arrives at a zone.
🔸 Info table Zones on chart · returns graded · overall reaction rate · freshness edge · base-volume edge · base-flow edge · live order flow direction and z-score · nearest demand and supply with ATR distance. Reads LEARNING until the warmup sample count is met.
🔸 Alerts Four alertcondition() calls: price entered a zone · return reacted · return failed · any resolved return. Worded as observations. Recommended alert setting: Once Per Bar Close.
――――――――――――――――――――――――――――――――――――――
🔷 INPUTS
🔸 Zone Detection Base Candle Max Range (ATR ×) — a candle counts as base while its range is below this multiple. Lower = cleaner zones, fewer of them. Default 0.60. Min / Max Base Candles — fewest and most candles that form a valid base. Default 1 / 6. Departure Strength (ATR ×) — how far price must travel from the base before the base qualifies as a zone. The single most important setting. Default 1.60. Departure Window (bars) — bars allowed for the departure to reach its target. Default 5. Zone Boundaries — Wick or Body extent for the base. Wick is the conservative read. Default Wick. Minimum Zone Height (ATR ×) — floor on zone thickness, expanded symmetrically about the base midpoint. Default 0.45. ATR Period — volatility yardstick for all distances. Default 14.
🔸 Return Resolution Reaction Target (ATR ×) — how far back away from the zone counts as a REACTION. Default 1.50. Break Buffer (ATR ×) — how far beyond the far edge price must CLOSE to count as a failure. Default 0.30. Return Timeout (bars) — bars a return stays open before being discarded as STALLED. Default 20. Zone Consumed On — Wick Touch / Body Touch / 50% Fill / Full Fill. Governs retirement only; returns always measure from the first wick. Default Body Touch. Max Returns Per Zone — a zone revisited this many times behaves like a range boundary. Default 4.
🔸 Probability Engine Warmup Samples — resolved returns required before the classifier replaces the running reaction rate. Default 25. Neighbours Compared — k in the nearest-neighbour vote. Smaller = more local; larger drifts toward the library rate. Default 8. Conviction Threshold — probability at or above which a zone draws at full conviction. Default 0.62. Approach Window — bars used to measure how fast price entered the zone. Default 5. Volume Baseline — averaging window for relative volume. Default 20. Trend EMA Period — reference for the trend-pressure feature. Default 50.
🔸 Order Flow Order Flow Band — show / hide. Default on. Flow Momentum Period — lookback for the rate of change of CVD. Default 14. Flow Band Width (ATR ×) — height of the band from the EMA to its outer edge. Default 1.00. Flow Normalisation Window — z-score window so the band reads the same across instruments. Default 50.
🔸 Visual Demand / Supply / In-zone / Consumed Colours · Show Zones · Zone Labels · Return History Ticks · Keep Consumed Zones · Max Live Zones (cap on live slots; consumed zones are free) · Zones Per Side (nearest N zones above and below price) · Show Zones Within ATR × (safety ceiling) · Label Every Zone · Label Size · Zone Border Width · Zone Evidence Grade.
🔸 Display Zen Mode — hides labels and info table; zones and ticks remain. Show Info Table.
――――――――――――――――――――――――――――――――――――――
🔷 REQUIREMENTS AND LIMITATIONS
🔸 The classifier reads what this chart has seen — not a pre-trained model and not a fixed statistical table. On a chart with thin history or a symbol the market has recently repriced, the library may be small and the read thin. The sample count travels with every zone label and the table header so this is never hidden. 🔸 Loading a different amount of chart history changes how many returns have trained the classifier, which changes the percentage shown on a zone. The zones themselves are unaffected — this is inherent to on-chart instance-based learning. 🔸 Zone geometry is fixed at birth and never re-centred. No request.security() call is made anywhere. Test state advances only on barstate.isconfirmed. No future data is referenced. 🔸 The departure is measured over bars that have already closed. A zone appears on the bar its departure qualifies and never moves afterwards. 🔸 Base volume and base flow are estimated from the close-position formula — a synthetic proxy, not true bid/ask data. The classifier adapts to the noise, but the quality of the read improves on instruments with genuine intrabar price travel. 🔸 The evidence grade (A–D) and the classifier percentage are two different statements by design. Do not read either alone. 🔸 Past resolved returns are hypothetical observations — no commission, no slippage — and are not a record of trading results. This script does not issue trade instructions and nothing in it is financial advice.
――――――――――――――――――――――――――――――――――――――
Built natively in Pine Script® v6. Lorentzian k-nearest-neighbour classifier trained on-chart from resolved supply/demand returns — no external libraries, no lookahead, no repainting. Zone formation uses a base-and-departure state machine; outcome is reaction magnitude, not hold-or-break. Attribution: the Rally-Base-Drop / Drop-Base-Rally construction is long-established public technical analysis, implemented independently here. The evidence grade and drawing layer are shared with the author's own Support Resistance AI — stated here plainly rather than left for a reader to find.
Open source — Mozilla Public License 2.0. Indicator
