OPEN-SOURCE SCRIPT

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

167
What changed

Flexible session window

Removed the old fixed NY end-time selector.

Added new inputs so you can pick start time and length:

London: ldnStartSel (default 08:00) and ldnLenSel with options 45/60/90 minutes.

New York: nyStartSel (default 15:30) and nyLenSel with options 45/60/90 minutes.

The session string used by time(refTF, sess, tz) is now built dynamically as "HHMM-HHMM" from start + length (e.g., 1530-1630).

The label shown in the table (winTxt) auto-formats to HH:MM–HH:MM.

New time helpers

addMinutesHHMM() computes the end time from a "HHMM" start plus a minute length.

makeSess() produces the session string "HHMM-HHMM".

prettySess() converts "HHMM-HHMM" → "HH:MM-HH:MM".
(Kept on one line to avoid the “end of line without line continuation” error.)

Stability & UI fixes

Main table now uses table.new(f_pos(tablePos), ...) directly (no undeclared pos variable).

Trade Gate panel uses a properly initialized gatePosEnum before table.new(...) (fixes “Undeclared identifier”).

Minor cleanups; no logic changes.

What did NOT change

Scoring logic: returns → optional ATR normalization → weights → anti-USD vs USD-base averages → final score.

Thresholds: minAbsScore and live intrath alerts are unchanged.

VWAP Gate logic is the same (price vs VWAP consistency depending on USD Strong/Weak).

Freeze/Lock of values at session end is unchanged.

Alerts (session close bias, live threshold cross, and “Entry hint”) are unchanged.

Why this helps (practical impact)

Longer windows (e.g., NY 60/90, LDN 60/90) usually make the score more robust, filtering noise and reducing false signals—at the cost of a slightly slower signal.

You can now A/B test:

London: 45 vs 60 vs 90

New York: 45 vs 60 vs 90
without touching anything else; the indicator adapts automatically.

How to use

Choose Session (London / New York).

Set the start and length for that session.

The background highlight, the winTxt, and the entry/exit logic all follow the dynamic window.

Quick tips to reduce false signals

Try NY 60 or NY 90 and LDN 60 when volatility is choppy.

Keep ATR normalization ON (useATRnorm = true) for more comparable returns.

Consider raising minAbsScore slightly (e.g., from 0.12 → 0.15–0.20) if you still see noise.

Use the VWAP Gate panel: only act when Bias OK and at least one of the Top-3 pairs shows VWAP OK.

If you want, I can add quick presets (buttons) to jump between LDN 45/60/90 and NY 45/60/90, or plot two Scores side by side for direct comparison.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.