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.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.