Candle Range Widget
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © caasimdas

//@version=5
indicator("Candle Range Widget", overlay=true)
prevdiff = high[1]- low[1]
diff = high-low
var srtable = table.new(position = position.top_right, columns = 2, rows= 3, frame_width = 1, frame_color = color.gray, border_width = 1, border_color = color.gray)
table.cell(srtable, column = 0, row =0, text ="High Low Difference", text_color = color.rgb(0, 0, 0), bgcolor = color.yellow)
table.merge_cells(srtable, 0, 0,1,0)
table.cell(srtable, column = 0, row =1, text = "Last Candle" , text_color = color.rgb(0, 0, 0), bgcolor = color.rgb(248, 248, 245))
table.cell(srtable, column = 0, row =2, text = "Previous Candle" , text_color = color.rgb(0, 0, 0), bgcolor = color.rgb(248, 248, 245))
table.cell(srtable, column = 1, row =1, text = str.tostring(diff) , text_color = color.rgb(0, 0, 0), bgcolor = color.rgb(248, 248, 245))
table.cell(srtable, column = 1, row =2, text = str.tostring(prevdiff) , text_color = color.rgb(0, 0, 0), bgcolor = color.rgb(248, 248, 245))
