Undeclared Identifier error in Pinescript while updating to version=5

Viewed 28

I am trying to convert BBMA study script to v=5 but getting Undeclared Identifier error in version=5

The original script can be found here -

https://www.tradingview.com/script/J1qL0xY4-BBMA-Oma-Ally-Light-Theme/

//@version=5
//revision history
//1.0.0:mutli-tf check

indicator(title = "SCLai/BBMA Oma Ally", shorttitle="BBMA DARK 2020", overlay = true)
//strategy("Bollinger + RSI, Double Strategy (by ChartArt) v1.1", shorttitle="CA_-_RSI_Bol_Strat_1.1", overlay=true)
plot_signal_ret     =input(false,title="Plot Signal RET",type=bool)
plot_signal_ext     =input(false,title="Plot Signal EXT",type=bool)
plot_signal_csa     =input(false,title="Plot Signal CSA",type=bool)
plot_signal_mmt     =input(false,title="Plot Signal MMT",type=bool)
plot_signal_ali     =input(false,title="Plot Alien Candle",type=bool)

///////////// Bollinger Bands

BBlength = 20 //input(20, minval=1,title="Bollinger Period Length")
BBmult   = 2 // input(2.0, minval=0.001, maxval=50,title="Bollinger Bands Standard Deviation")
midBB    = ta.sma(close, 20)
midBB_p  = ta.sma(close[1],20)
BBdev    = BBmult * ta.stdev(close, BBlength)

topBB    = midBB_p + BBdev
lowBB    = midBB_p - BBdev
topBB_p  = midBB_p + BBdev
lowBB_p  = midBB_p - BBdev

mahi5   =ta.wma(high, 5)
mahi10  =ta.wma(high, 10)
malo5   =ta.wma(low, 5)
malo10  =ta.wma(low, 10)

mahi5_p   =ta.wma(high[1], 5)
malo5_p   =ta.wma(low[1], 5)


p_midBB=plot(midBB, color=color.yellow,style=linebr,linewidth=2, title="Bollinger Bands Mid")
//p0=plot(n % 1.5 != 0 ? midBB : na, style=linebr, linewidth=3, color=color.teal, transp=0)
plot(midBB, title="MidBB", style=circles, linewidth=2, color=color.white,editable=false)
p_topBB = plot(topBB, color=color.white,linewidth=2,title="Bollinger Bands Upper Line")
p_lowBB = plot(lowBB, color=color.white,linewidth=2,title="Bollinger Bands Lower Line")


//p1 = plot(a1,color=color.fuchsia, linewidth=0,  transp=70)
p_mahi5  = plot(mahi5,color=color.fuchsia, linewidth=1,  transp=0,title="mahi5")
p_mahi10 = plot(mahi10,color=color.red, linewidth=2,  transp=0,title="mahi10")

p_malo5  = plot(malo5,color=color.aqua, linewidth=1,  transp=0,title="malo5")
p_malo10 = plot(malo10,color=color.blue, linewidth=2,  transp=0,title="malo10")

p_ta.ema50  = plot(ta.ema(close,50),color=color.lime,linewidth=4,transp=0,title="ta.ema50")
//h1=iff(barstate.islast,close+0.1,na)
//hline(h1, title='Hi', color=color.blue, linestyle=dotted, linewidth=0)
//hline(1.5, title='Lo', color=color.blue, linestyle=dotted, linewidth=0)

//signal RET
reject_mahi=(high > mahi5) and (close < mahi5) and (close < mahi10) and (close < midBB) and (mahi5 < midBB) 
plotshape(reject_mahi and plot_signal_ret, style=shape.triangledown,location=location.abovebar, color=color.red,transp=50)
reject_malo=(low < malo5) and (close > malo5) and (close > malo10) and (close > midBB) and (malo5 > midBB) 
plotshape(reject_malo and plot_signal_ret, style=shape.triangleup,location=location.belowbar, color=color.green,transp=50)

//signal CSA
csak_sell=(open > midBB) and (close < midBB) 
plotshape(csak_sell and plot_signal_csa, style=shape.diamond,location=location.abovebar, color=color.red,transp=50)
csak_buy  =(open < midBB) and (close > midBB) 
plotshape(csak_buy and plot_signal_csa, style=shape.diamond,location=location.belowbar, color=color.green,transp=50)

csaa = (close < malo10) or (close > mahi10)
//extreme
ext_sell=(close[1] > topBB_p) and (open > topBB) and (close < topBB) and (mahi5_p > topBB_p)
plotshape(ext_sell and plot_signal_ext, style=shape.xcross,location=location.abovebar, color=color.red,transp=50)
ext_buy  =(close[1] < lowBB_p) and (open < lowBB) and (close > lowBB) and (malo5_p < lowBB_p)
plotshape(ext_buy and plot_signal_ext, style=shape.xcross,location=location.belowbar, color=color.green,transp=50)

//mmt
mmt_sell=(close < lowBB) and (open > lowBB)
plotshape(mmt_sell and plot_signal_mmt, style=shape.arrowdown,location=location.belowbar, color=color.red,transp=50)
mmt_buy =(close > topBB) and (open < topBB)
plotshape(mmt_buy and plot_signal_mmt, style=shape.arrowup,location=location.abovebar, color=color.green,transp=50)

//alien
ali_sell= (open < lowBB) and (close < lowBB)
plotshape(ali_sell and plot_signal_ali, style=shape.flag,location=location.belowbar, color=color.red,transp=50)
ali_buy = (open > topBB) and (close > topBB)
plotshape(ali_buy and plot_signal_ali, style=shape.flag,location=location.abovebar, color=color.green,transp=50)


//shortCondition = crossunder(security(tickerid, Period, close),security(tickerid, Period, open))
signal_reentry    =   reject_mahi or reject_malo

signal_csak       =   csak_sell or csak_buy

signal_extreme    =   ext_sell or ext_buy

signal_csm        =   mmt_sell or mmt_buy

signal_alien      =   ali_sell or ali_buy


signal_mahi = close > mahi5
signal_malo = close < malo5

signal_csaa = csaa

//alertcondition(reject_malo, "buy", "buy-reject MALO5")
//alertcondition(reject_mahi, "sell", "sell-reject MAHI5")
alertcondition(signal_reentry, "REENTRY", "REENTRY")
alertcondition(signal_csak,    "CSAK", "CSAK")
alertcondition(signal_extreme, "EXTREME", "EXTREME")
alertcondition(signal_csm, "CSM", "CSM")
alertcondition(signal_alien, "ALIEN", "ALIEN")


alertcondition(signal_mahi,"MAHI","MAHI5")
alertcondition(signal_malo,"MALO","MALO5")

alertcondition(signal_csaa,"CSAA","CSAA/CHK")

errors

Processing script...
line 7: Undeclared identifier 'bool'
line 7: The 'input' function does not have an argument with the name 'type'
line 8: The 'input' function does not have an argument with the name 'type'
line 9: The 'input' function does not have an argument with the name 'type'
line 10: The 'input' function does not have an argument with the name 'type'
line 11: The 'input' function does not have an argument with the name 'type'
line 35: Undeclared identifier 'linebr'
line 37: Undeclared identifier 'circles'
line 49: User variable identifiers should not contain '.' character: 'p_ta.ema50'.

Any help would be greatly appreciated. Trying to base a strategy on the script.

Have a nice day

Ariff Nawi

0 Answers
Related