OPEN-SOURCE SCRIPT

Key Trading Session Times (UK) with DST Adjust

56
//version=5
indicator("Key Trading Session Times (UK) with DST Adjust", overlay=true)

// === Inputs ===
showAsia = input.bool(true, "Show Asia Session (12 AM – 6 AM UK)")
showLondon = input.bool(true, "Show London Open (6:30 AM – 9 AM UK)")
showNY = input.bool(true, "Show NY Open (1 PM – 3 PM UK)")

// === DST Adjustment Logic ===
// Define the start and end of daylight saving time (DST)
isDST = (month >= 3 and month <= 10) // DST from March to October

// === Time Ranges (Europe/London) with DST Adjustment ===
inSession(sessionStartHour, sessionStartMinute, sessionEndHour, sessionEndMinute) =>
t = time("1", "Europe/London")
sessionStart = timestamp("Europe/London", year(t), month(t), dayofmonth(t), sessionStartHour, sessionStartMinute)
sessionEnd = timestamp("Europe/London", year(t), month(t), dayofmonth(t), sessionEndHour, sessionEndMinute)
if isDST
sessionStart := sessionStart + 3600 // Add 1 hour during DST
sessionEnd := sessionEnd + 3600 // Add 1 hour during DST
time >= sessionStart and time <= sessionEnd

// === Define Sessions ===
asiaSession = inSession(0, 0, 6, 0)
londonSession = inSession(6, 30, 9, 0)
nySession = inSession(13, 0, 15, 0)

// === Background Highlights ===
bgcolor(showAsia and asiaSession ? color.new(color.blue, 85) : na, title="Asia Session")
bgcolor(showLondon and londonSession ? color.new(color.green, 85) : na, title="London Session")
bgcolor(showNY and nySession ? color.new(color.orange, 85) : na, title="New York Session")

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.