[英]Pinescript: How to set a plotshape label below/above the Bar with some distance?
//@version=4
study("My Script", overlay = true)
ema1 = ema(close, 13)
ema2 = ema(close, 50)
condition = crossover(ema1, ema2)
plot(ema1)
plot(ema2)
//
atr_dist = atr(14) //atr distance
perc_dist = input(2.0, "Distance in %:") //% distance
if condition
// label.new(bar_index, high + atr_dist, "Above", style=label.style_label_down, color = color.green)
label.new(bar_index, high + high *perc_dist /100, "Above", style=label.style_label_down, color = color.green) //or use % as distance
// label.new(bar_index, high - atr_dist, "Below", style=label.style_label_up, color = color.red)
label.new(bar_index, low - low *perc_dist /100, "Below", style=label.style_label_up, color = color.red) //or use % as distance
你可以使用\n
例子:
plotchar(dcc, title="Dark cloud cover", char="☁", location=location.top, color=color.orange, text=".\n.\n.\Dcc")
plotshape(test, title="test",style=shape.circle, location=location.belowbar, color=color.red, text="test\n\n")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.