OPEN-SOURCE SCRIPT

USD Session 8FX - LDN & NY (TF-invariant, Live + Table)

116
What it is

A USD strength/weakness meter for the London (08:00–08:45) or New York (15:30–16:00/16:15) session. It blends the movement of 8 markets—EURUSD, GBPUSD, AUDUSD, NZDUSD, USDCHF, USDCAD, USDJPY, XAUUSD—into one Score that is timeframe-invariant (it uses a 1-minute “boundary TF” under the hood so changing chart TF doesn’t change the math).

Core logic (simple)

During the chosen session window, it records each symbol’s start and live end prices, computes returns, optionally normalizes by ATR (volatility), applies your weights, and averages anti-USD (EUR/GBP/AUD/NZD/XAU) vs USD-base (CHF/CAD/JPY) groups.

The final Score is the normalized sum of weighted contributions:

Score > 0 → “USD Strong”

Score < 0 → “USD Weak”

At the session close it freezes (“Locked”) the results so you can review them later.

What you see

Main plot: the USD Score line (with a 0 baseline).

Optional lines: Anti-USD average vs USD-base average (post-normalization, pre-weights).

Session background shading (London silver, New York aqua).

Live table with:

Each symbol’s % change, its weight, and its contribution to the Score.

TOP badges for the two biggest drivers (by absolute contribution).

A Side column (only for the two TOPs) showing BUY/SELL aligned with the USD verdict (e.g., if USD Strong → SELL anti-USD pairs like EURUSD, BUY USD-base like USDCHF).

Verdict row with USD Strong/Weak, the Score value, the window text, and whether you’re LIVE / CLOSED / FROZEN.

Trade Gate panel:

Shows Verdict (USD Strong/Weak), Bias OK/weak (|Score| vs your threshold), Top-1/Top-2 VWAP checks, an overall GATE: OK/NO, and an Entry hint string (e.g., “SELL EURUSD, BUY USDCHF”) when conditions align.

VWAP “Trade Gate”

It confirms alignment between the USD bias and price vs VWAP for the top movers:

If USD Strong: anti-USD symbols should be below VWAP (short bias), USD-base symbols above VWAP (long bias).

If USD Weak: the opposite.

Gate = OK only if |Score| ≥ minAbsScore and at least one of the two TOP symbols is on the correct side of VWAP.

Tip: set vwapTF to an intraday value (“1”, “5”, “15”) for reliable VWAP on higher-TF charts.

Alerts

At session close: “USD Strong/Weak – session close”.

Live threshold: alerts when |Score| crosses your intraday threshold up/down.

Entry hint (Gate OK): triggers when the Gate flips from NO → OK inside the window.

If you create an alert of type “Any alert() function call”, you also get a dynamic message like:
ENTRY HINT • Hint: SELL EURUSD, BUY USDCHF

Key inputs you can tweak

Session: London vs New York; NY end time 16:00 or 16:15.

Timezone: default Europe/Tirane.

Boundary TF: default “1” (keeps the indicator TF-invariant).

minAbsScore: sensitivity threshold for “Bias OK”.

ATR normalization (len): stabilizes comparisons across different volatility regimes.

VWAP settings: toggle panel and set vwapTF.

How to use (playbook)

Choose the session (e.g., New York 15:30–16:15), keep Boundary TF = 1.

If you’re on a higher-TF chart, set vwapTF = "1" or "5".

Watch Score and Verdict; when |Score| ≥ minAbsScore, bias is meaningful.

Check Top-1/Top-2 and the Trade Gate:

If Gate = OK, use the Entry hint (e.g., “SELL EURUSD, BUY USDCHF”) as the aligned idea.

Use your own execution rules (e.g., structure, risk, stops) on the suggested symbols.

After close, review the Frozen table to validate behavior and refine thresholds/weights.

Notes & edge cases

If some markets are illiquid/holiday, a few returns may be na; the script handles that gracefully.

If ta.vwap is na on high TFs, the Gate will simply not confirm—set vwapTF intraday.

You can customize weights (e.g., reduce XAUUSD to -0.3 or similar) to suit your basket philosophy.

If you want, I can add toggles to show Side for all 8 symbols, or print a one-line summary (e.g., “USD Strong • Score 0.23 • Gate OK • SELL EURUSD, BUY USDCHF”) in the top-left of the pane.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน