转换Pine脚本V2到V3

发布于 2025-01-31 04:24:18 字数 793 浏览 4 评论 0原文

这是我的代码。

isBuyPlotted=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init

buySignal=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted

我尝试修改Pine版本2至版本3。

isBuyPlotted=0.0
isBuyPlotted:=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init
buySignal=0.0
buySignal:=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted

但是此错误发生。 变量BuySignal用浮点类型声明。无法分配类型系列的表达[bool]

This is my code.

isBuyPlotted=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init

buySignal=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted

I try to modify pine version 2 to version 3.

isBuyPlotted=0.0
isBuyPlotted:=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init
buySignal=0.0
buySignal:=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted

But this error happens.
Variable buySignal was declared with float type. Cannot assign it expression of type series[bool]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻风 2025-02-07 04:24:18

这两个变量均为bool在原始代码中,但您已将其声明为float。这就是错误消息告诉您的。

将其更改为:

isBuyPlotted=false
buySignal=false
isBuyPlotted:=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init
buySignal:=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted

Both those variables are of type bool in the original code but you have declared them as float. That's what the error message tells you.

Change it to:

isBuyPlotted=false
buySignal=false
isBuyPlotted:=isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false or nz(buySetup)==9?false:buySignal[1]==true  // init
buySignal:=nz(buySetup[MAXSIGNALDELAY])>9-MAXSIGNALDELAY and close>nz(high[1]) and nz(close[1])>nz(open[1]) and nz(close)>nz(open) and not isBuyPlotted
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文