Kris
Kris

Reputation: 13

pine script 4: Variable 'buySignal' was declared with 'series[integer]' type. Cannot assign it expression of type 'series[bool]'

How can I convert below two lines to version 4 of pine script:

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

thanks

Upvotes: 0

Views: 1566

Answers (1)

PineCoders-LucF
PineCoders-LucF

Reputation: 8779

All the context isn't in your code snippet, but this should work:

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

Upvotes: 0

Related Questions