I attach here the original probuilder code, can someone help me pls? Thanks a lot
// Costants.
// The six trend values are fictional
period = 13
deviation1 = 1
deviation2 = 2
longupper= 30
longmiddle=20
longlower=10
shortlower=-30
shortmiddle=-20
shortupper=-10
// (i) indicators
iSTD1 = deviation1 * STD[period](close)
iSTD2 = deviation2 * STD[period](close)
iSTD3 = deviation3 * STD[period](close)
iSMA = Average[period,0](close)
// (c) conditions
cUpperBand2 = iSMA + iSTD2 // ----2----
cUpperBand1 = iSMA + iSTD1 // ----1----
cMiddleBand = iSMA // ----0----
cLowerBand1 = iSMA - iSTD1 // ----1----
cLowerBand2 = iSMA - iSTD2 // ----2----
// Bollinger's Logic
// Initial set trend, based on first std dev
if trend=0 and close crosses over cUpperband1 then
trend = longupper
elsif trend=0 and close crosses under cLowerBand1 then
trend = shortlower
endif
// Follows first set trend
// Change of trend
if trend = longupper and close crosses under cUpperBand1 then
trend = longmiddle
endif
if trend=longmiddle then
if close crosses under cMiddleBand then
trend=longlower
elsif close crosses over cUpperBand2 then
trend=longupper
else
trend = longmiddle
endif
endif
if trend=longlower then
if close crosses under cLowerBand1 then
trend=shortlower
elsif close crosses over cUpperBand1 and close < cUpperBand2 then
trend = longmiddle
elsif close crosses over cUpperBand2 then
trend=longupper
else
trend=longlower
endif
endif
if trend=shortlower and Close crosses over cLowerBand1 then
trend=shortmiddle
endif
if trend=shortmiddle then
if close crosses over cMiddleBand then
trend=shortupper
elsif close crosses under cLowerBand2 then
trend = shortlower
else
trend=shortmiddle
endif
endif
if trend = shortupper then
if close crosses over cUpperBand1 then
trend=longupper
elsif close crosses under cLowerBand1 and close > cLowerBand2 then
trend=shortmiddle
elsif close crosses under cLowerBand2 then
trend=shortlower
else
trend = shortupper
endif
endif
// defines the values of 'ts' at the appropriate Bollinger band level
if trend = longupper or trend = shortupper then
ts = cUpperBand1
elsif trend = longmiddle or trend = shortmiddle then
ts = cMiddleBand
elsif trend = longlower or trend = shortlower then
ts = cLowerBand1
endif
// colors
if trend = longupper or trend = longmiddle or trend = longlower then
r = 0
g = 255 // colors the "ts" trendline in green
elsif trend = shortupper or trend=shortmiddle or trend=shortlower then
r = 255 // colors the "ts" trendline in red
g = 0
endif
return ts coloured(r,g,0) style(line,2) as "BTrend"

Comment