Candle Info by Monty
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MontyTheGuy

//@version=5
indicator("Candle Info by Monty", overlay=true)
int pLabel = input.int(20, 'Panel Index', minval=2)
var string lab = na
var string lText = na
var float infoLbText=na
bool cInfo=input.bool(false,"Show Candle OHLC",tooltip="OHLC: Open High Low Close")
string TTString="W2W - Wick to Wick \nCO2C - Candle Open to Current Price"
string Calc=input.string(title="% Calculation Mode",defval="Wick to Wick",options=["Wick to Wick","Candle Open To Current"],tooltip=TTString)
color cText=input.color(color.new(color.white,0),title="Label Text Color")
color cLabel=input.color(color.new(color.blue,10),title="Label Background Color")
label infoLabel = label.new(time, close, xloc=xloc.bar_time, color=cLabel, textcolor=cText, style=label.style_label_left, size=size.normal)
if Calc=="Wick to Wick"
    lab :="W2W Move: "
    infoLbText := math.round(math.abs(close > open ? ((high-low)/low)*100 : ((low-high)/high)*100),3)
else
    lab := "CO2C Move: "
    infoLbText := math.round(math.abs(close > open ? ((close-open)/open)*100 : ((open-close)/close)*100),3)
if cInfo
    lText := str.tostring(lab) + str.tostring(infoLbText) + "%\n Open : " +  str.tostring(math.round(math.abs(open))) + "\n Wick High : " +  str.tostring(math.round(math.abs(close))) + "\n Wick Low : " +  str.tostring(math.round(math.abs(low))) + "\n Close/Current : " +  str.tostring(math.round(math.abs(close)))
else
    lText := lab + str.tostring(infoLbText) + "%"
label.set_text(id=infoLabel, text= str.tostring(lText))
label.set_x(infoLabel, label.get_x(infoLabel) + math.round(ta.change(time) * pLabel))
label.delete(infoLabel[1])
