From the chat room, I don't understand what these lines mean?
Code: Select all
f_print(_text) => var _label
And this line:
Code: Select all
f_print(syminfo.ticker + "\n" + timeframe.period)
I understand inside the bracket, but what is f_print doing?
Eventually, I'd like to make the text more dynamic.
Here is the full script:
Code: Select all
//@version=4
study("Watermark Label", shorttitle="Watermark", overlay=true)
// Input
showWaterMrk = input(title="Show WaterMark Details", type=input.bool, defval=true)
// Watermark Label
wtrmrk_YLoc = input(title="Watermark Y Location", type=input.float, defval=2.0, step=0.25)
wtrmrk_XLoc = input(title="Watermark X Location", type=input.integer, defval=-8)
bar_Duration = time - time[1]
offset = wtrmrk_XLoc * bar_Duration
highest = highest(high, 13) + (atr(14)) * wtrmrk_YLoc
labelCol = close[1]>open[1] ? color.green : color.red
textCol = close[1]>open[1] ?color.white : color.lime
// Label - label.new(x, y, text, xloc, yloc, color, style, textcolor, size, textalign, tooltip)
f_print(_text) => var _label = label.new(time, y=na, text=_text, xloc=xloc.bar_time, yloc=yloc.price, color=color.white, style=label.style_label_center,
textcolor=color.black, size=size.large, textalign=text.align_center),
label.set_xy(_label, time + offset, highest),
label.set_text(_label, _text),
label.set_color(_label, labelCol),
label.set_textcolor(_label, textCol)
f_print(syminfo.ticker + "\n" + timeframe.period)
// End of Watermark
Thank you.