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

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.
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.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。