Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Silver Bullet ICT time range", overlay=true)
- bgColor = input.bool(false, "Activate High/Low View")
- LondonColor = color.new(color.green, 90)
- NYColor = color.new(color.red, 90)
- AsiaColor = color.new(color.yellow, 90)
- ///Sessions
- res = input.timeframe("D", "Resolution", ["D","W","M"])
- london = input.session("0300-0400:1234567", "London Session")
- ny = input.session("1000-1100:1234567", "New York AM")
- tokyo = input.session("1400-1500:1234567", "New York PM")
- //Bars
- is_newbar(sess) =>
- t = time(res, sess, "America/New_York")
- na(t[1]) and not na(t) or t[1] < t
- is_session(sess) =>
- not na(time(timeframe.period, sess, "America/New_York"))
- //London
- London = input.bool(true, "London Session")
- londonNewbar = is_newbar(london)
- londonSession = is_session(london)
- float londonLow = na
- londonLow := if londonSession
- if londonNewbar
- low
- else
- math.min(londonLow[1],low)
- else
- londonLow
- float londonHigh = na
- londonHigh := if londonSession
- if londonNewbar
- high
- else
- math.max(londonHigh[1],high)
- else
- londonHigh
- plotLL = plot(londonLow, color=color.new(#000000, 100))
- plotLH = plot(londonHigh, color=color.new(#000000, 100))
- fill(plotLL, plotLH, color = londonSession and London and bgColor ? LondonColor : na)
- bgcolor(londonSession and London and not bgColor ? LondonColor : na)
- //New York
- NY = input.bool(true, "New York Session AM")
- nyNewbar = is_newbar(ny)
- nySession = is_session(ny)
- float nyLow = na
- nyLow := if nySession
- if nyNewbar
- low
- else
- math.min(nyLow[1],low)
- else
- nyLow
- float nyHigh = na
- nyHigh := if nySession
- if nyNewbar
- high
- else
- math.max(nyHigh[1],high)
- else
- nyHigh
- plotNYL = plot(nyLow, color=color.new(#000000, 100))
- plotNYH = plot(nyHigh, color=color.new(#000000, 100))
- fill(plotNYL, plotNYH, color = nySession and NY and bgColor ? NYColor : na)
- bgcolor(nySession and NY and not bgColor ? NYColor : na)
- //Tokyo
- Tokyo = input.bool(true, "New York Session PM")
- tokyoNewbar = is_newbar(tokyo)
- tokyoSession = is_session(tokyo)
- float tokyoLow = na
- tokyoLow := if tokyoSession
- if tokyoNewbar
- low
- else
- math.min(tokyoLow[1],low)
- else
- tokyoLow
- float tokyoHigh = na
- tokyoHigh := if tokyoSession
- if tokyoNewbar
- high
- else
- math.max(tokyoHigh[1],high)
- else
- tokyoHigh
- plotTL = plot(tokyoLow, color=color.new(#000000, 100))
- plotTH = plot(tokyoHigh, color=color.new(#000000, 100))
- fill(plotTL, plotTH, color = tokyoSession and Tokyo and bgColor ? AsiaColor : na)
- bgcolor(tokyoSession and Tokyo and not bgColor ? AsiaColor : na)
- //Sydney
Advertisement
Add Comment
Please, Sign In to add comment