London candle range
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pula78

//@version=5
indicator("London candle range", overlay = true)
t1 = time_close(timeframe.period, "0900-1000", "Europe/Warsaw")

barcolor(t1 ? color.purple : na)

range_bar_middle = 0.0
range_bar_upper_band = 0.0
range_bar_lower_band = 0.0

if t1
    range_bar_middle := math.abs(high - low) / 2 + low
    range_bar_upper_band := math.abs(high - low) / 2 + high
    range_bar_lower_band := low - (math.abs(high - low) / 2)

    line.new(bar_index, low, bar_index + 5, low)
    line.new(bar_index, high, bar_index + 5, high)
    line.new(bar_index, range_bar_middle, bar_index + 5, range_bar_middle)
    line.new(bar_index, range_bar_upper_band, bar_index + 5, range_bar_upper_band)
    line.new(bar_index, range_bar_lower_band, bar_index + 5, range_bar_lower_band)


