OPEN-SOURCE SCRIPT
Session Liquidity Architecture [MQLSoftware]

Session Liquidity Architecture reads the trading day as a repeating structure of sessions — and instead of restating fixed session folklore, it measures how the instrument on your chart actually behaves inside that structure.
Most session tools draw boxes and stop there. This indicator adds three algorithmic elements on top of the session-box base, and every number it prints is derived from the chart's own history.
Key Features
Core Concept — what is original here
Session boxes are common. The original contribution of this script is that it treats the session map as a measurement problem:
1. Percentile-ranked session ranges. A "big" or "quiet" session is only meaningful relative to that session's own recent distribution. Ranking the live range against the last N completed ranges of the same session produces a self-calibrating expansion read that works identically on FX majors, indices, or crypto — without any instrument-specific settings.
2. A liquidity state machine instead of static lines. Session extremes are treated as objects with a lifecycle (armed, swept, rejected/accepted, expired). Because state transitions happen only on confirmed bars, the sweep history you see on the chart is exactly the history the statistics are built from.
3. Base rates instead of narratives. The common claims about session behavior ("London takes out the Asia range", "the sweep reverses") become testable numbers here. A counted event is strictly defined: a sweep is the first confirmed-bar break of an armed level while the later session is active, and it counts as "rejected" when the sweep bar closes back inside the level. On some instruments the measured frequencies are strongly asymmetric; on others (for example 24/7 crypto) they hover near a coin flip — and the panel will honestly show you that. The point is to replace assumption with measurement on the exact chart you trade.
Anatomy of the Display
Notes on Repainting
Typical Analysis Workflow
Configuration
Markets and Timeframes
Intraday timeframes only (the script tells you if the chart is not intraday). Best readability from 5m to 1h. Works on FX, indices, futures, stocks and crypto — on 24/7 markets the session definitions matter more than the defaults, so adjust the hours to your venue.
Alerts
This is a visual analytical tool for chart reading and session-structure context. It does not generate buy/sell signals, does not execute trades, and does not provide financial advice.
Most session tools draw boxes and stop there. This indicator adds three algorithmic elements on top of the session-box base, and every number it prints is derived from the chart's own history.
Key Features
- Self-calibrating session range model — every completed session range is ranked as a percentile of that session's own trailing distribution. The active session shows a live read: current range, % of its median, and the percentile it has already reached. No pip or point thresholds, no magic numbers — the model adapts to any symbol and timeframe by construction.
- Session liquidity state machine — each session's High and Low arm at session close and are then tracked through explicit states: armed → swept → rejected or accepted. A sweep is only registered on a confirmed bar; the rejection read compares the sweep bar's close against the level. Levels that survive until the next same-session open are marked expired.
- Measured base rates — the panel reports observed frequencies from the loaded history: how often London actually sweeps the Asia High or Low on this chart, how often New York sweeps the London extremes, and how often price closes back inside after each sweep. These are counted events with the sample size shown (n), not assumptions — and below a minimum sample the panel says "collecting" instead of quoting a percentage.
- Three configurable sessions (Asia, London, New York) with per-session IANA timezones, so daylight-saving shifts are handled automatically.
- Previous Day High / Low tracked through the same armed → swept state machine.
- Day separators, per-session colors, and a compact statistics panel.
Core Concept — what is original here
Session boxes are common. The original contribution of this script is that it treats the session map as a measurement problem:
1. Percentile-ranked session ranges. A "big" or "quiet" session is only meaningful relative to that session's own recent distribution. Ranking the live range against the last N completed ranges of the same session produces a self-calibrating expansion read that works identically on FX majors, indices, or crypto — without any instrument-specific settings.
2. A liquidity state machine instead of static lines. Session extremes are treated as objects with a lifecycle (armed, swept, rejected/accepted, expired). Because state transitions happen only on confirmed bars, the sweep history you see on the chart is exactly the history the statistics are built from.
3. Base rates instead of narratives. The common claims about session behavior ("London takes out the Asia range", "the sweep reverses") become testable numbers here. A counted event is strictly defined: a sweep is the first confirmed-bar break of an armed level while the later session is active, and it counts as "rejected" when the sweep bar closes back inside the level. On some instruments the measured frequencies are strongly asymmetric; on others (for example 24/7 crypto) they hover near a coin flip — and the panel will honestly show you that. The point is to replace assumption with measurement on the exact chart you trade.
Anatomy of the Display
- Session boxes — one box per session per day, labelled with the session name; completed boxes append the final range and its percentile (e.g. "LONDON 0.00421 · P63").
- Level lines — each session's High/Low extends right from the moment it arms at session close. A red ✕ mark shows where it was swept. Untouched levels turn dotted when they expire at the next same-session open.
- PDH / PDL — dashed lines for the previous day's extremes, same sweep marking.
- Statistics panel — one row per session (live or last range + percentile, and the state of its levels; states shown during a live session are prefixed "prev" because they belong to the previous cycle), followed by the measured base-rate block with sample sizes.
Notes on Repainting
- Sweep events, rejection reads, base-rate counters and all alerts fire on confirmed bars only and do not repaint.
- Session boxes, the live range and the live percentile update intrabar while a session is open — they are visual context for the current session, not signals.
- No security() calls, no lookahead: everything is computed from the chart's own bars.
- Boxes and level lines are drawing objects anchored to past bars by design (a session box spans its session, a level line starts at the bar of the extreme). This affects only how history is displayed, never the event logic.
Typical Analysis Workflow
- Check the panel: how much of its typical range has the active session already used? A session at 40% of median is quiet by its own history; one at P90 has already been unusually wide for that session. These numbers describe the distribution so far — they do not predict what the next bar will do.
- Watch the armed levels from the prior session and the previous day: they are the objective reference points the state machine is tracking.
- When a sweep prints, read the rejection/acceptance tag and compare it with the measured base rate for that exact scenario on this chart.
Configuration
- Session hours and timezone per session (defaults: Tokyo 09:00–18:00 JST, London 08:00–17:00 UK, New York 09:30–16:00 ET). Futures/FX traders can widen them or repurpose a slot as a killzone.
- Rendering depth, box transparency, day separators, PDH/PDL on/off.
- Sweep marks: Minimal (small ✕ text) or Pill, and how many days of marks to keep.
- Stats lookback (sessions) for the percentile model; panel position and text size.
Markets and Timeframes
Intraday timeframes only (the script tells you if the chart is not intraday). Best readability from 5m to 1h. Works on FX, indices, futures, stocks and crypto — on 24/7 markets the session definitions matter more than the defaults, so adjust the hours to your venue.
Alerts
- Liquidity swept — any session extreme or PDH/PDL taken (confirmed bar). The alert() message names the exact level and outcome, e.g. "EURUSD 60 — liquidity swept: ASIA H (rejected)".
- Session range expansion — the active session crossed the 80th percentile of its own history.
- Session opened.
This is a visual analytical tool for chart reading and session-structure context. It does not generate buy/sell signals, does not execute trades, and does not provide financial advice.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
🟣 Free tools, guides & product resources:
mqlsoftware.com/account/
🟣 New tools, releases & updates:
t.me/mqlsoftware_official
MQLSoftware — trading analysis tools & indicators.
mqlsoftware.com/account/
🟣 New tools, releases & updates:
t.me/mqlsoftware_official
MQLSoftware — trading analysis tools & indicators.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
🟣 Free tools, guides & product resources:
mqlsoftware.com/account/
🟣 New tools, releases & updates:
t.me/mqlsoftware_official
MQLSoftware — trading analysis tools & indicators.
mqlsoftware.com/account/
🟣 New tools, releases & updates:
t.me/mqlsoftware_official
MQLSoftware — trading analysis tools & indicators.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.