Visible Range High Low [vnhilton]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vnhilton

//Inspired by PineCoders' "VisibleChart" library & "Chart VWAP" by TradingView

//@version=5
indicator("Visible Range High Low [vnhilton]", "VRHL", true)

//Getting access to functions from PineCoders' "VisibleChart" library
import PineCoders/VisibleChart/4 as PCVC

//Label parameters
highLabelColor = input.color(color.rgb(0, 165, 49, 80), "High Label Color")
highTextColor = input.color(color.rgb(0, 165, 49, 0), "High Text Color")

lowLabelColor = input.color(color.rgb(255, 109, 90, 80), "Low Label Color")
lowTextColor = input.color(color.rgb(255, 109, 90, 0), "Low Text Color")

//Getting OHLCV values
[chartOpen, chartHigh, chartLow, chartClose, chartVolume] = PCVC.ohlcv()

//Getting HL time
int highTime = PCVC.highBarTime()
int lowTime = PCVC.lowBarTime()

//Plotting labels
var label highLabel = label.new(na, na, na, xloc.bar_time, yloc.price, highLabelColor, label.style_label_down, highTextColor)
var label lowLabel = label.new(na, na, na, xloc.bar_time, yloc.price, lowLabelColor, label.style_label_up, lowTextColor)

label.set_xy(highLabel, highTime, chartHigh)
label.set_xy(lowLabel, lowTime, chartLow)
label.set_text(highLabel, str.tostring(chartHigh, format.mintick))
label.set_text(lowLabel, str.tostring(chartLow, format.mintick))