用文字的plotshape替换箭头

时间:2019-10-21 21:37:27

标签: pine-script

我有一个脚本,该脚本在移动平均线交叉时添加了一个箭头,但希望显示标签向上/标签向下。

    study(title="MA 5/10 Strategy", shorttitle="MA Strategy 5/10", overlay=true)
exponential = input(true, title="Exponential MA")

src = close

ma5 = exponential ? ema(src, 5) : sma(src, 5)
ma10 = exponential ? ema(src, 10) : sma(src, 10)

buy_cond = cross(ma5, ma10) and ma5 > ma10
sell_cond = cross(ma5, ma10) and ma5 < ma10

plotarrow(buy_cond ? 1 : 0, colordown=lime, maxheight=25, minheight=15)
plotarrow(sell_cond ? -1 : 0, colorup=red, maxheight=25, minheight=15)

plot( ma5, color=green, style=line, title="5", linewidth=1)
plot( ma10, color=red, style=line, title="10", linewidth=1)

alertcondition(buy_cond, title = "Go Long", message = "Go Long")
alertcondition(sell_cond, title = "Go Short", message = "Go Short")

0 个答案:

没有答案