TG - Stock price at particular bar
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © thiyagarajan_gunasekaran

//@version=4
study(title="Script day value", overlay=true)
//indicator(title="Script day value", shorttitle="SDV", overlay=true, timeframe="D")

dur = input(title="Time frame", type=input.string, defval='D')

barInt = input(title="No of bars back", type=input.integer, defval=1)
curbarInt = input(title="Current bar", type=input.integer, defval=1)

scr_label = '\nSymbol Value: \n'

secVal1 = security(syminfo.tickerid, dur, close[barInt]) 
curVal1 = security(syminfo.tickerid, dur, close[curbarInt])
scr_label := secVal1 > 0 ? scr_label + syminfo.tickerid + '\n Old value : ' + tostring(secVal1) + '\n New value : ' + tostring(curVal1) + '\n': scr_label


lab_l = label.new(bar_index, bar_index, scr_label,color = color.white, textcolor = color.black, size= size.normal, textalign = text.align_left, style = label.style_label_up, yloc = yloc.belowbar)
         
            
label.delete(lab_l[1])

plot(0, transp=100)
