pine 脚本 4:变量 'buySignal' 声明为 'series[integer]' 类型。无法为其分配 'series[bool]' 类型的表达式
pine script 4: Variable 'buySignal' was declared with 'series[integer]' type. Cannot assign it expression of type 'series[bool]'
如何将以下两行转换为 pine 脚本的第 4 版:
isBuyPlotted=nz(buySetup)==9?false:buySignal[1]==true or isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false // 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
谢谢
所有上下文都不在您的代码片段中,但这应该有效:
isBuyPlotted = false
isBuyPlotted := nz(buySetup)==9?false:buySignal[1]==true or isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false // init
buySignal = false
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 脚本的第 4 版:
isBuyPlotted=nz(buySetup)==9?false:buySignal[1]==true or isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false // 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
谢谢
所有上下文都不在您的代码片段中,但这应该有效:
isBuyPlotted = false
isBuyPlotted := nz(buySetup)==9?false:buySignal[1]==true or isBuyPlotted[1]==true?true:nz(buySetup[MAXSIGNALDELAY+1])==9?true:false // init
buySignal = false
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