PROTECTED SOURCE SCRIPT
C7CB w/ BB % Filter

//version=5
indicator("C7CB-BB Ver 1", overlay=true)
// Inputs
bbLen = input.int(20, title="BB Length")
bbMult = input.float(2, title="BB Multiplier")
bbPctThresh = input.float(0.10, title="BB Proximity %", step=0.01, minval=0, maxval=1)
// Bollinger Bands
basis = ta.sma(close, bbLen)
dev = bbMult * ta.stdev(close, bbLen)
upper = basis + dev
lower = basis - dev
// Plot
pUp = plot(upper, title="BB Upper", color=color.red)
pLo = plot(lower, title="BB Lower", color=color.green)
plot(basis, title="BB Basis", color=color.blue)
fill(pUp, pLo, color.new(color.blue, 90))
// Body size
f_body(i) => math.abs(close - open)
// C7CB pattern
bullPattern =
close[3] < open[3] and
close[2] < open[2] and
close[1] < open[1] and
f_body(3) > f_body(2) and
f_body(2) > f_body(1)
bearPattern =
close[3] > open[3] and
close[2] > open[2] and
close[1] > open[1] and
f_body(3) > f_body(2) and
f_body(2) > f_body(1)
// Trigger candle
isBullTrig = close > open
isBearTrig = close < open
basicBuy = bullPattern and isBullTrig
basicSell = bearPattern and isBearTrig
// BB proximity filter
bandWidth = upper - lower
distLower = close - lower
distUpper = upper - close
buyFilter = basicBuy and distLower <= bandWidth * bbPctThresh
sellFilter = basicSell and distUpper <= bandWidth * bbPctThresh
// Labels
if barstate.isconfirmed and buyFilter
label.new(bar_index, low, "BUY", color=color.green, textcolor=color.white, style=label.style_label_up, yloc=yloc.belowbar)
if barstate.isconfirmed and sellFilter
label.new(bar_index, high, "SELL", color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)
// Alertconditions (message phải là literal string)
alertcondition(buyFilter, title="BUY", message="BUY near lower BB")
alertcondition(sellFilter, title="SELL", message="SELL near upper BB")
indicator("C7CB-BB Ver 1", overlay=true)
// Inputs
bbLen = input.int(20, title="BB Length")
bbMult = input.float(2, title="BB Multiplier")
bbPctThresh = input.float(0.10, title="BB Proximity %", step=0.01, minval=0, maxval=1)
// Bollinger Bands
basis = ta.sma(close, bbLen)
dev = bbMult * ta.stdev(close, bbLen)
upper = basis + dev
lower = basis - dev
// Plot
pUp = plot(upper, title="BB Upper", color=color.red)
pLo = plot(lower, title="BB Lower", color=color.green)
plot(basis, title="BB Basis", color=color.blue)
fill(pUp, pLo, color.new(color.blue, 90))
// Body size
f_body(i) => math.abs(close - open)
// C7CB pattern
bullPattern =
close[3] < open[3] and
close[2] < open[2] and
close[1] < open[1] and
f_body(3) > f_body(2) and
f_body(2) > f_body(1)
bearPattern =
close[3] > open[3] and
close[2] > open[2] and
close[1] > open[1] and
f_body(3) > f_body(2) and
f_body(2) > f_body(1)
// Trigger candle
isBullTrig = close > open
isBearTrig = close < open
basicBuy = bullPattern and isBullTrig
basicSell = bearPattern and isBearTrig
// BB proximity filter
bandWidth = upper - lower
distLower = close - lower
distUpper = upper - close
buyFilter = basicBuy and distLower <= bandWidth * bbPctThresh
sellFilter = basicSell and distUpper <= bandWidth * bbPctThresh
// Labels
if barstate.isconfirmed and buyFilter
label.new(bar_index, low, "BUY", color=color.green, textcolor=color.white, style=label.style_label_up, yloc=yloc.belowbar)
if barstate.isconfirmed and sellFilter
label.new(bar_index, high, "SELL", color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)
// Alertconditions (message phải là literal string)
alertcondition(buyFilter, title="BUY", message="BUY near lower BB")
alertcondition(sellFilter, title="SELL", message="SELL near upper BB")
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。