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")
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.