OPEN-SOURCE SCRIPT
更新済

Judas Swing Detector [AGPro Series]

3 318
Judas Swing Detector [AGPro Series]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OVERVIEW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The Judas Swing is a well-known intraday pattern in ICT (Inner Circle Trader)
methodology describing how price often makes a deceptive initial move at the
London or New York session open — pulling in participants in one direction —
before reversing to reveal the session's true directional bias.

Judas Swing Detector systematically identifies, visualizes, and tracks this
pattern across every London and New York session open. It shades the trap
zone, flags the reversal bar, highlights the true-direction bias, and maintains
a rolling 20-session performance log so users can assess how consistently the
pattern resolves on their chosen symbol and timeframe.

IMPORTANT — Timeframe requirement: This indicator is designed for intraday
charts of 1 hour or lower (1m, 5m, 15m, 30m, 1h). Session windows anchor the
entire logic, and a 1-hour Judas window cannot be resolved on 4-hour or higher
charts. The panel always shows an "Optimal TF: 1m - 1h" footer, and the TF
status row turns yellow with "use <=1h" if the current chart exceeds this
range.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
UNIQUE EDGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unlike generic session-open or breakout indicators, Judas Swing Detector is
built around a defined four-state lifecycle (Pending → Active → Forming →
Confirmed / Failed) with ATR-normalized thresholds, so detection remains
stable across different volatility regimes and asset classes.

Three design choices make it distinct:

1. Independent two-way extremum tracking inside the Judas window — both the
maximum upward and maximum downward excursion are recorded, and the larger
of the two is declared the fake move when the window closes. This removes
ambiguity in choppy openings.

2. Separate fake-move and reversal thresholds. The initial push must exceed
a minimum ATR-scaled size to qualify, and the reversal must travel a second
ATR-scaled distance beyond the session open — filtering out shallow round
trips that would otherwise inflate the signal count.

3. Rolling 20-session statistics panel reporting success rate, average fake
distance, and directional bias, giving discretionary traders an objective
view of how the pattern is behaving on their instrument before they act on
it.

4. Support/resistance-style invalidation zone drawn at the fake-move extremum
after confirmation. This gives a clear visual anchor: if price later
re-enters this zone from the opposite side during the session, the Judas
read is considered broken. The zone is a reference, not an automatic
signal.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
METHODOLOGY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Step 1 — Session anchoring
At the first bar of the configured London or New York window the script
records the session open price, resets the two-way extremum trackers, and
transitions to the Active state.

Step 2 — Fake-move accumulation
During the window the script tracks both the maximum high and minimum low
relative to the session open. Neither is committed as the fake move until the
window closes.

Step 3 — Window-close evaluation
When the window ends the larger excursion (up vs down) becomes the fake
direction. If its size reaches the user-defined ATR multiple it qualifies and
the script transitions to the Forming state; otherwise it resets to idle.

Step 4 — Reversal confirmation
In the Forming state the script waits for price to cross the session open in
the opposite direction of the fake move and travel at least the configured
ATR-scaled distance beyond it. When that happens the swing is Confirmed and
the true direction is drawn on the chart. If the reversal window expires
without confirmation the swing is recorded as Failed.

Step 5 — History log
Every confirmed and failed outcome is appended to a rolling 20-session log
used by the statistics panel.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SIGNALS & ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

On-chart visuals:
• Dashed vertical line at session start (accent color)
• "LON" or "NY" label at the session anchor bar (Balanced / Detailed only)
• Shaded fake-move box from session open to fake extremum, colored opposite
to the true direction (a bearish trap is shaded in the bear tone because
the true direction is down — and vice versa)
• Optional "Fake" distance label at the extremum (Detailed density only)
• Reversal marker "X UP" or "X DOWN" at the confirmation bar, offset
from the candles for readability
• Horizontal support/resistance-style invalidation zone around the fake
extremum, extending 40 bars to the right — a visual reference for where
the Judas read would break down if price re-enters the zone

Alert conditions (toggle individually in settings):
• Judas Swing Forming — fake move has qualified, waiting for reversal
• Judas Swing Confirmed — reversal threshold crossed, true direction known
• Judas Swing Failed — reversal window expired without confirmation


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
KEY INPUTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Session Windows
• Track London Open — toggle London session monitoring
• London Judas Window (NY time) — session string, default 0200-0300
• Track New York Open — toggle NY session monitoring
• NY Judas Window (NY time) — session string, default 0930-1030
• Session Timezone — timezone used to interpret the windows
• Reversal Window (minutes) — maximum time after window close in which a
valid reversal can still be recorded

Detection Logic
• Min Fake-Move Size (ATR mult) — minimum excursion required to qualify
• Reversal Confirmation (ATR mult) — distance beyond session open needed
to confirm the reversal
• ATR Length — lookback for threshold scaling

Visuals
• Show Session Start Line, Show Fake-Move Zone, Show Reversal Marker,
Show Invalidation Zone — individual visual toggles
• Label Density — Minimal / Balanced / Detailed
• Font Size — tiny / small / normal / large (applies to labels and panel)
• Theme — Dark / Light (panel only, chart candles unaffected)

Panel
• Show Info Panel — master toggle
• Panel Location — 6 chart positions
• Always displays: current session, state, true direction, fake distance,
rolling 20-session statistics (success rate, avg distance, bull/bear
bias), current TF status, and a footer reminding the optimal timeframe
range

Alerts — three individual toggles (Forming / Confirmed / Failed)


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Supported timeframes: 1m, 5m, 15m, 30m, 1h. These resolve a session's early
structure cleanly while keeping enough bars inside each Judas window for the
extremum tracker to work with. Recommended default: 15m or 1h.

Not supported: 4h, 1D, 1W. On these timeframes a single bar exceeds the
session window, so nothing is detected. The panel will show a yellow "use
<=1h" hint if you accidentally switch to one of these.

Recommended instruments: FX majors (EURUSD, GBPUSD, USDJPY), index futures
(NQ, ES), liquid crypto (BTC, ETH). The ATR-normalized thresholds keep the
logic portable across these asset classes.

Workflow suggestion:

1. Apply the indicator and let it observe several sessions so the panel
populates a meaningful sample.
2. Review the 20-session success rate on your specific symbol and timeframe.
This is not a forecast — it is a descriptive statistic of how the pattern
has resolved in recent history on that chart.
3. Use the Forming alert as a heads-up, and the Confirmed alert as the main
event. The true-direction arrow marks the bias of the remaining session,
not a trade entry or exit.
4. Combine with your own structural context — higher timeframe bias, key
levels, liquidity pools — before acting on any signal.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LIMITATIONS & TRANSPARENCY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

• Not a strategy. This is a discretionary analysis tool; it neither places
orders nor implies any specific trade setup.
• Intraday timeframes only. The logic requires 1h or lower charts to resolve
the session windows. On 4h, 1D or higher the indicator will not detect
anything and the panel will show a "use <=1h" notice.
• No forecasting. Displayed statistics describe past behavior on the current
chart only and do not imply future performance.
• Pattern-dependent. When price opens and trends cleanly in one direction
without a fake move, the pattern legitimately will not trigger. Low
signal count on such sessions is expected behavior, not a malfunction.
• Session boundary sensitivity. Results depend on the configured session
windows and timezone. Outside the major FX and equities session hours the
ICT framing may not translate cleanly.
• Extreme-volatility sessions. During very large gaps or news spikes the ATR
thresholds can be dominated by a single bar; users should review the
defaults in those conditions.
• Symbol coverage. Pip conversion handles forex and JPY pairs explicitly and
falls back to tick-based sizing for other asset types. Values are intended
as relative magnitudes, not broker-specific pip quotes.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
RISK DISCLOSURE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This indicator is provided for educational and analytical purposes only. It
does not constitute financial advice, a recommendation, or a solicitation to
buy or sell any instrument. Trading involves substantial risk of loss; past
pattern behavior is not indicative of future results. Users are responsible
for their own trading decisions and for verifying that any signal aligns with
their own methodology and risk management.

The source code is published under the Mozilla Public License 2.0. Feedback
and constructive suggestions are welcome.
リリースノート
🔧 UPDATE NOTES - v1.5

This update focuses on naming and text consistency refinements.

The core purpose of the script remains unchanged.
This release tidies up how the script presents its labels, tooltips, and alerts.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

- Consistent short title
The chart short title was shortened and aligned with the rest of the series for consistent naming.

- Cleaner tooltip and alert text
Session tooltips and alert messages now use plain, consistent characters for better display across platforms.


------------------------
Visual Improvements
------------------------

- Kept the existing reversal markers, fake-move zones, and session lines unchanged

- Maintained the clean default label density

- Preserved the existing panel layout and color palette


------------------------
Interface & Usability
------------------------

- Kept all existing settings, themes, and toggles unchanged

- Refined wording for clearer tooltips and alert messages

- Enhanced overall consistency without changing core logic


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

The session detection, fake-move evaluation, reversal confirmation, and the last-20-sessions statistics all behave exactly as before.

Users should interpret outputs the same way as before.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical and visualization tool.

It is designed for intraday timeframes of 1h or lower; on higher timeframes the session windows cannot be resolved.

Outputs should always be interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.
リリースノート
🔧 UPDATE NOTES - v1.6

This update focuses on label contrast and reversal-marker overlap cleanup.

The core purpose of the script remains unchanged. It still detects the Judas
Swing — the deceptive first move at the London and New York opens that traps
early participants before the true intraday direction reveals itself — and
tracks success metrics across the last 20 sessions.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Contrast-aware label text
On-chart label text color is now derived from each label's actual background
luminance, for the reversal markers, the fake-move label, and the session start
label. Previously these used a fixed light text that read faintly on the pink
(bearish), indigo (session) and lighter backgrounds. Every marker now reads
crisply on both directions.

• Non-overlapping reversal markers
Reversal markers (X UP / X DOWN) now check against recent markers and shift
vertically when two confirmations land close together on the chart. This removes
the stacked-marker overlap that could appear when sessions reversed near the
same price level. Marker history is also capped so the chart stays clean over
long ranges.


------------------------
Visual Improvements
------------------------

• Higher-contrast reversal, fake-move and session labels.

• Eliminated reversal-marker stacking when two sessions confirmed near the same
price.


------------------------
Interface & Usability
------------------------

• The statistics panel (Session, State, True Dir, Fake Dist, Success, Avg Dist,
Bias, TF) is unchanged; only the header text color was aligned to the
contrast standard.


------------------------
Behavior Notes
------------------------

This update does not change any session-window, fake-move, reversal-detection,
state-machine or history logic. Only label text color and the on-chart vertical
placement of reversal markers were adjusted. Interpretation of all outputs is
unchanged. The script remains designed for intraday timeframes of 1h or lower.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool. Market conditions such as
volatility, liquidity, session timing and timeframe differences may affect how
Judas swings and the success metrics appear. Outputs should always be
interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only. It does not provide
financial advice or guaranteed trading outcomes. Users remain responsible for
their own decisions.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。