Reputation: 13
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
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