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. مؤشر

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. مؤشر

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. مؤشر

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.
مؤشر

مؤشر

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.
مؤشر

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. مؤشر

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. مؤشر

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. مؤشر

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.
مؤشر

استراتيجية

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. مؤشر

مؤشر

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.
مؤشر

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. مؤشر

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. مؤشر
