PROTECTED SOURCE SCRIPT

My script

58
//version=5
indicator("Session Highs and Lows", overlay=true)

// Session Time Inputs
asiaStart = timestamp(year, month, day, 0, 0)
asiaEnd = timestamp(year, month, day, 8, 0)
londonStart = timestamp(year, month, day, 8, 0)
londonEnd = timestamp(year, month, day, 13, 0)
usStart = timestamp(year, month, day, 13, 0)
usEnd = timestamp(year, month, day, 21, 0)

// Variables to store session highs and lows
var float asiaHigh = na
var float asiaLow = na
var float londonHigh = na
var float londonLow = na
var float usHigh = na
var float usLow = na

// Update session highs and lows
asiaHigh := (time >= asiaStart and time < asiaEnd) ? math.max(asiaHigh, high) : asiaHigh
asiaLow := (time >= asiaStart and time < asiaEnd) ? math.min(asiaLow, low) : asiaLow

londonHigh := (time >= londonStart and time < londonEnd) ? math.max(londonHigh, high) : londonHigh
londonLow := (time >= londonStart and time < londonEnd) ? math.min(londonLow, low) : londonLow

usHigh := (time >= usStart and time < usEnd) ? math.max(usHigh, high) : usHigh
usLow := (time >= usStart and time < usEnd) ? math.min(usLow, low) : usLow

// Plot Highs and Lows
plot(asiaHigh, color=color.blue, linewidth=2, title="Asia High")
plot(asiaLow, color=color.blue, linewidth=2, title="Asia Low")
plot(londonHigh, color=color.green, linewidth=2, title="London High")
plot(londonLow, color=color.green, linewidth=2, title="London Low")
plot(usHigh, color=color.red, linewidth=2, title="US High")
plot(usLow, color=color.red, linewidth=2, title="US Low")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.