如何更新 PineScript 以使用版本 5 和买入卖出信号?

问题描述 投票:0回答:1

你能帮我更新这个以使用版本 5 和“买入卖出信号吗?没有 pine 编辑器版本。我正在尝试制作版本 5。我还想添加买入和卖出信号。如果我可以隐藏值为 80 和 20。

study(title = "instagram: askincantum", shorttitle = "instagram: askincantum", overlay = true)

//Mode
RSI = input(title="Line", defval=80, minval=1, maxval = 100)

//RSI
src = close,

ep = 2 * RSI - 1
auc = ema( max( src - src[1], 0 ), ep )
adc = ema( max( src[1] - src, 0 ), ep )
x1 = (RSI - 1) * ( adc * 70 / (100-70) - auc)
ub = iff( x1 >= 0, src + x1, src + x1 * (100-70)/70 )
x2 = (RSI - 1) * ( adc * 30 / (100-30) - auc)
lb = iff( x2 >= 0, src + x2, src + x2 * (100-30)/30 )

//Affichage
plot(avg(ub, lb), color=blue , style = line, linewidth=2, title="Line")


len = input(20, minval=1, title="Entry")
src1 = input(close, title="Source")
offset = input(title="Offset", type=integer, defval=0, minval=-500, maxval=500)
out = wma(src1, len)
plot(out, title="Entry", color=yellow, linewidth = 2, offset=offset)


plotshape(crossover(RSI, len) , style = shape.triangleup , location = location.belowbar , color = green , size = size.large)
plotshape(crossunder(RSI, len) , style = shape.triangledown , location = location.abovebar , color = red , size = size.large)
pine-script pine-script-v5 indicator
1个回答
0
投票

我的建议是在最顶部添加

//@version=4
。 您需要执行上述操作才能看到将脚本转换为 V5 的选项。

然后,从 PineEditor 中,您将看到一个转换为版本 5 的选项,然后单击“保存”

您可能会在错误控制台中看到一些需要修复的语法问题 - 您会看到可以理解的错误消息

文档:

https://www.tradingview.com/pine-script-docs/en/v5/migration_guides/To_Pine_version_5.html

© www.soinside.com 2019 - 2024. All rights reserved.