// --- PARAMETERS ---
sessionStartHour = 8 // Change to match session start time (e.g. London Open)
sessionEndHour = 16 // Change to match session end time (e.g. London Close)
// VWAP + Price Aggregation
cumVol = 0
cumVolPrice = 0
// Session High/Low/Mean
sessionHigh = -1e10
sessionLow = 1e10
sessionOpen = open
// Detect New Session (reset at session start)
if time = sessionStartHour * 10000 then
cumVol = 0
cumVolPrice = 0
sessionHigh = high
sessionLow = low
sessionOpen = open
endif
// Update during session
if time >= sessionStartHour * 10000 and time <= sessionEndHour * 10000 then
cumVol = cumVol + volume
cumVolPrice = cumVolPrice + close * volume
sessionHigh = max(sessionHigh, high)
sessionLow = min(sessionLow, low)
endif
// Calculated values
vwap = cumVolPrice / cumVol
sessionMean = (sessionHigh + sessionLow + sessionOpen) / 3
// --- DISPLAY ---
draw vwap as "VWAP" coloured(0, 128, 255)
draw sessionMean as "Mean" coloured(255, 165, 0)
draw sessionHigh as "High" coloured(0, 255, 0)
draw sessionLow as "Low" coloured(255, 0, 0)