如何使用pine-script在tradingview上添加图像/徽标水印?
我可以添加文本:
study("WaterMark + 4EMA [SilentKreator]", shorttitle="EMA + WM", overlay=true)
len1 = input(7, minval=1, title="EMA1")
len2 = input(25, minval=1, title="EMA2")
len3 = input(55, minval=1, title="EMA3")
len4 = input(200, minval=1, title="EMA4")
out1 = ema(close, len1)
out2 = ema(close, len2)
out3 = ema(close, len3)
out4 = ema(close, len4)
plot(out1, title="EMA1", color=color.yellow)
plot(out2, title="EMA2", color=color.red)
plot(out3, title="EMA3", color=color.green)
plot(out4, title="EMA4", color=color.blue)
Nombre = input("Nombre", title="WaterMark")
vcolor = input(color.new(color.white, 95), title="Color")
a = label.new(bar_index, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(a[1])
b = label.new(bar_index - 50, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(b[1])
c = label.new(bar_index - 150, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(c[1])
d = label.new(bar_index - 500, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(d[1])
e = label.new(bar_index - 1000, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(e[1])
f = label.new(bar_index - 1500, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(f[1])
g = label.new(bar_index - 2000, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(g[1])
h = label.new(bar_index - 4000, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(h[1])
i = label.new(bar_index - 6000, high, Nombre,
textcolor=vcolor,
style=label.style_none, yloc=yloc.price, size=size.huge)
label.delete(i[1])这是官方支持的,还是可以通过pinescript实现的?我已经找了好几个小时了,但除了https://www.tradingview.com/script/ue1GHiNc-CryptoRADO-Watermarking-Tool-by-Cryptorhythms/没人能做到
发布于 2021-06-16 14:12:55
Tradingview已发布open source example of a watermark。
// REUSING THIS CODE: You are welcome to reuse this code without permission, including in closed-source publications. Credits are appreciated.
//@version=4
study("Watermark", "", true)
// Watermark
// v1.0, 2021.05.27 19:06
// This code was written using the PineCoders Coding Conventions for Pine: http://www.pinecoders.com/coding_conventions/
string i_text1 = input("ITradingView", "Text 1", inline = "11")
string i_text2 = input("IPine", "Text 2", inline = "11", tooltip = "Clear 'Text 2' to prevent animation.")
string i_tableYpos = input("bottom", "Position", inline = "12", options = ["top", "middle", "bottom"])
string i_tableXpos = input("left", "", inline = "12", options = ["left", "center", "right"])
int i_height = input(3, "Height", minval = 1, maxval = 100, inline = "13")
int i_width = input(10, "Width", minval = 1, maxval = 100, inline = "13", tooltip = "1-100")
color i_c_text = input(color.new(color.white, 30), "Text", inline = "14")
string i_textSize = input("normal", "Size", inline = "14", options = ["tiny", "small", "normal", "large", "huge", "auto"])
color i_c_bg = input(color.new(color.blue, 50), "Background")
// We use `var` to only initialize the table on the first bar.
var table watermark = table.new(i_tableYpos + "_" + i_tableXpos, 1, 1)
// We only populate the table on the last bar; it's more efficient.
if barstate.islast
// This `varip` variable will preserve its value across realtime updates.
varip bool _changeText = true
// Toggle this value on each update.
_changeText := not _changeText
// If there's a "Text 2" string in inputs and it's time to flip, change the text.
string _txt = str.length(i_text2) != 0 and _changeText ? i_text2 : i_text1
// Populate our table cell.
table.cell(watermark, 0, 0, _txt, i_width, i_height, i_c_text, text_size = i_textSize, bgcolor = i_c_bg)https://stackoverflow.com/questions/67980905
复制相似问题