本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
// ============================================================================
// Smart Money Concepts Screener, Order Blocks, FVG & BOS [LunqFX]
// ----------------------------------------------------------------------------
// One table, fifteen symbols, the five things a smart money concepts trader
// checks on every chart: structure (BOS / CHoCH), the nearest unmitigated
// order block, the nearest unfilled fair value gap, premium or discount
// inside the current swing range, and the last liquidity sweep. Rows are
// ranked so the symbols where something is happening right now come first.
//
// It reports the state of each market. It does not grade setups and prints
// no entries, stops or targets.
//
// NON-REPAINTING: every symbol is requested on the chart timeframe with
// lookahead off; swings are confirmed pivots; everything is read from
// closed bars.
// ============================================================================
indicator("Smart Money Concepts Screener, Order Blocks, FVG & BOS [LunqFX]", "SMC Screener [LunqFX]",
overlay = true, max_boxes_count = 20, max_lines_count = 80, max_labels_count = 120)
// ─────────────────────────────────────────────────────────────────────────
// INPUTS
// ─────────────────────────────────────────────────────────────────────────
gS = "Symbols"
s1 = input.symbol("OANDA:XAUUSD", "1", inline = "a", group = gS)
s2 = input.symbol("OANDA:EURUSD", "2", inline = "a", group = gS)
s3 = input.symbol("OANDA:GBPUSD", "3", inline = "a", group = gS)
s4 = input.symbol("OANDA:USDJPY", "4", inline = "b", group = gS)
s5 = input.symbol("OANDA:AUDUSD", "5", inline = "b", group = gS)
s6 = input.symbol("OANDA:USDCAD", "6", inline = "b", group = gS)
s7 = input.symbol("OANDA:NZDUSD", "7", inline = "c", group = gS)
s8 = input.symbol("OANDA:USDCHF", "8", inline = "c", group = gS)
s9 = input.symbol("OANDA:GBPJPY", "9", inline = "c", group = gS)
s10 = input.symbol("OANDA:XAGUSD", "10", inline = "d", group = gS)
s11 = input.symbol("OANDA:NAS100USD", "11", inline = "d", group = gS)
s12 = input.symbol("OANDA:US30USD", "12", inline = "d", group = gS)
s13 = input.symbol("OANDA:SPX500USD", "13", inline = "e", group = gS)
s14 = input.symbol("BITSTAMP:BTCUSD", "14", inline = "e", group = gS)
s15 = input.symbol("BITSTAMP:ETHUSD", "15", inline = "e", group = gS)
gM = "Smart money concepts"
pivLen = input.int(5, "Swing length", minval = 2, maxval = 20, group = gM, tooltip = "Bars on each side that confirm a swing high or low. The swings define structure, the premium / discount range and the liquidity that can be swept.")
freshN = input.int(10, "Fresh event (bars)", minval = 1, maxval = 100, group = gM, tooltip = "A BOS, CHoCH or sweep within this many bars is highlighted and ranks the row higher.")
nearAtr = input.float(1.0, "Near an OB / FVG (× ATR)", minval = 0.1, maxval = 10, step = 0.1, group = gM)
scanBars = input.int(1500, "Bars scanned per symbol", minval = 300, maxval = 5000, step = 100, group = gM, tooltip = "Lower = faster loading.")
gC = "This chart"
showOwn = input.bool(true, "Draw this symbol's nearest OB and FVG", group = gC)
showStr = input.bool(true, "Draw this symbol's BOS / CHoCH", group = gC)
showPD = input.bool(true, "Draw premium / discount range", group = gC)
showSwp = input.bool(true, "Mark liquidity sweeps", group = gC)
keepEv = input.int(6, "Structure events kept", minval = 1, maxval = 30, group = gC)
gT = "Table"
tblPos = input.string("Top Right", "Position", options = ["Top Right", "Middle Right", "Bottom Right", "Top Left", "Bottom Left"], group = gT)
tblSize = input.string("Normal", "Text size", options = ["Tiny", "Small", "Normal"], group = gT)
rowsN = input.int(15, "Rows shown", minval = 3, maxval = 15, group = gT)
gA = "Alerts"
alChoch = input.bool(true, "Alert: CHoCH on any symbol", group = gA)
alOb = input.bool(true, "Alert: price enters an order block on any symbol", group = gA)
alSw = input.bool(false, "Alert: liquidity sweep on any symbol", group = gA)
candOn_ = input.bool(true, "Neon candles", group = "Visuals")
candGlw = input.bool(true, "Glow candles", group = "Visuals", tooltip = "Each body is drawn in four bands that brighten towards the close. Off = flat translucent bodies.")
// ─────────────────────────────────────────────────────────────────────────
// THEME — teal / coral on a terminal ink, indigo accent
// ─────────────────────────────────────────────────────────────────────────
bgLum = 0.2126 * color.r(chart.bg_color) + 0.7152 * color.g(chart.bg_color) + 0.0722 * color.b(chart.bg_color)
isLight = bgLum > 128
BULL = isLight ? #0D9488 : #2DD4BF
BEAR = isLight ? #DC2626 : #F87171
ACC = isLight ? #4F46E5 : #818CF8
TXT = isLight ? #1A1D24 : #E8EAF0
MUTE = isLight ? #5E6472 : #8F96A6
PANEL = isLight ? #FFFFFF : #090B11
ROW = isLight ? #F1F3F8 : #121521
ROW2 = isLight ? #E7EAF1 : #0E1019
INK = #090B11
tSize = tblSize == "Tiny" ? size.tiny : tblSize == "Normal" ? size.normal : size.small
// ─────────────────────────────────────────────────────────────────────────
// THE SMC ENGINE — run on every symbol
// ─────────────────────────────────────────────────────────────────────────
smc(int len) =>
atr = ta.atr(14)
ph = ta.pivothigh(high, len, len)
pl = ta.pivotlow(low, len, len)
var float swH = na
var float swL = na
var bool hUsed = true
var bool lUsed = true
if not na(ph)
swH := ph
hUsed := false
if not na(pl)
swL := pl
lUsed := false
// structure: a close through the last swing; against the trend it is a CHoCH
var int trend = 0
var int evt = 0
var int evtBar = na
// order blocks: the last opposite candle before the move that broke structure
var float obBT = na
var float obBB = na
var int obBX = na
var float obST = na
var float obSB = na
var int obSX = na
if barstate.isconfirmed
if not na(swH) and not hUsed and close > swH
evt := trend == -1 ? 2 : 1
trend := 1
evtBar := bar_index
hUsed := true
for i = 1 to 15
if close[i] < open[i]
obBT := high[i]
obBB := low[i]
obBX := bar_index - i
break
if not na(swL) and not lUsed and close < swL
evt := trend == 1 ? 2 : 1
trend := -1
evtBar := bar_index
lUsed := true
for i = 1 to 15
if close[i] > open[i]
obST := high[i]
obSB := low[i]
obSX := bar_index - i
break
// mitigation: a close through the far side retires the block
if not na(obBB) and close < obBB
obBT := na
obBB := na
if not na(obST) and close > obST
obST := na
obSB := na
// fair value gaps: the latest unfilled one on each side
var float fBT = na
var float fBB = na
var int fBX = na
var float fST = na
var float fSB = na
var int fSX = na
if barstate.isconfirmed
if low > high[2]
fBT := low
fBB := high[2]
fBX := bar_index - 1
if high < low[2]
fST := low[2]
fSB := high
fSX := bar_index - 1
if not na(fBB) and low <= fBB
fBT := na
fBB := na
if not na(fST) and high >= fST
fST := na
fSB := na
// liquidity sweep: a wick beyond the last swing that closes back inside
var int swDir = 0
var int swBar = na
if barstate.isconfirmed
if not na(swH) and high > swH and close < swH
swDir := -1
swBar := bar_index
if not na(swL) and low < swL and close > swL
swDir := 1
swBar := bar_index
// nearest order block and gap: 0 distance = price is inside
dB = na(obBT) ? na : close > obBT ? (close - obBT) / atr : close >= obBB ? 0.0 : na
dS = na(obSB) ? na : close < obSB ? (obSB - close) / atr : close <= obST ? 0.0 : na
obDir = na(dB) and na(dS) ? 0 : na(dS) or (not na(dB) and dB <= dS) ? 1 : -1
obD = obDir == 1 ? dB : obDir == -1 ? dS : na
gB = na(fBT) ? na : close > fBT ? (close - fBT) / atr : close >= fBB ? 0.0 : na
gS_ = na(fSB) ? na : close < fSB ? (fSB - close) / atr : close <= fST ? 0.0 : na
fvDir = na(gB) and na(gS_) ? 0 : na(gS_) or (not na(gB) and gB <= gS_) ? 1 : -1
fvD = fvDir == 1 ? gB : fvDir == -1 ? gS_ : na
pd = not na(swH) and not na(swL) and swH > swL ? (close - swL) / (swH - swL) * 100 : na
[trend, evt, bar_index - evtBar, obDir, obD, fvDir, fvD, pd, swDir, bar_index - swBar,
obDir == 1 ? obBT : obST, obDir == 1 ? obBB : obSB, obDir == 1 ? obBX : obSX,
fvDir == 1 ? fBT : fST, fvDir == 1 ? fBB : fSB, fvDir == 1 ? fBX : fSX]
// ─────────────────────────────────────────────────────────────────────────
// SCAN
// ─────────────────────────────────────────────────────────────────────────
[t1, e1, a1, o1, od1, f1, fd1, p1, w1, wa1, _x1, _y1, _z1, _u1, _v1, _w1] = request.security(s1, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t2, e2, a2, o2, od2, f2, fd2, p2, w2, wa2, _x2, _y2, _z2, _u2, _v2, _w2] = request.security(s2, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t3, e3, a3, o3, od3, f3, fd3, p3, w3, wa3, _x3, _y3, _z3, _u3, _v3, _w3] = request.security(s3, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t4, e4, a4, o4, od4, f4, fd4, p4, w4, wa4, _x4, _y4, _z4, _u4, _v4, _w4] = request.security(s4, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t5, e5, a5, o5, od5, f5, fd5, p5, w5, wa5, _x5, _y5, _z5, _u5, _v5, _w5] = request.security(s5, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t6, e6, a6, o6, od6, f6, fd6, p6, w6, wa6, _x6, _y6, _z6, _u6, _v6, _w6] = request.security(s6, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t7, e7, a7, o7, od7, f7, fd7, p7, w7, wa7, _x7, _y7, _z7, _u7, _v7, _w7] = request.security(s7, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t8, e8, a8, o8, od8, f8, fd8, p8, w8, wa8, _x8, _y8, _z8, _u8, _v8, _w8] = request.security(s8, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t9, e9, a9, o9, od9, f9, fd9, p9, w9, wa9, _x9, _y9, _z9, _u9, _v9, _w9] = request.security(s9, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t10, e10, a10, o10, od10, f10, fd10, p10, w10, wa10, _x10, _y10, _z10, _u10, _v10, _w10] = request.security(s10, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t11, e11, a11, o11, od11, f11, fd11, p11, w11, wa11, _x11, _y11, _z11, _u11, _v11, _w11] = request.security(s11, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t12, e12, a12, o12, od12, f12, fd12, p12, w12, wa12, _x12, _y12, _z12, _u12, _v12, _w12] = request.security(s12, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t13, e13, a13, o13, od13, f13, fd13, p13, w13, wa13, _x13, _y13, _z13, _u13, _v13, _w13] = request.security(s13, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t14, e14, a14, o14, od14, f14, fd14, p14, w14, wa14, _x14, _y14, _z14, _u14, _v14, _w14] = request.security(s14, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
[t15, e15, a15, o15, od15, f15, fd15, p15, w15, wa15, _x15, _y15, _z15, _u15, _v15, _w15] = request.security(s15, timeframe.period, smc(pivLen), calc_bars_count = scanBars)
// this chart's own symbol, for the boxes
[tC, eC, aC, oC, odC, fC, fdC, pC, wC, waC, obTop, obBot, obX, fvTop, fvBot, fvX] = smc(pivLen)
// ─────────────────────────────────────────────────────────────────────────
// THIS CHART — nearest order block and gap
// ─────────────────────────────────────────────────────────────────────────
var box obBx = na
var box fvBx = na
if barstate.islast and showOwn
box.delete(obBx)
box.delete(fvBx)
if oC != 0 and not na(obTop)
c = oC == 1 ? BULL : BEAR
obBx := box.new(obX, obTop, bar_index + 12, obBot, border_color = color.new(c, 20), bgcolor = color.new(c, 82), border_width = 1,
text = (oC == 1 ? "BULLISH OB" : "BEARISH OB"), text_color = c, text_size = size.small, text_halign = text.align_right)
if fC != 0 and not na(fvTop)
c = fC == 1 ? BULL : BEAR
fvBx := box.new(fvX, fvTop, bar_index + 12, fvBot, border_color = color.new(ACC, 30), bgcolor = color.new(ACC, 86), border_width = 1, border_style = line.style_dashed,
text = (fC == 1 ? "BULLISH FVG" : "BEARISH FVG"), text_color = ACC, text_size = size.small, text_halign = text.align_right)
// ─────────────────────────────────────────────────────────────────────────
// THIS CHART — structure breaks, sweeps and the premium / discount range
// ─────────────────────────────────────────────────────────────────────────
cPh = ta.pivothigh(high, pivLen, pivLen)
cPl = ta.pivotlow(low, pivLen, pivLen)
var float cH = na
var int cHB = na
var float cL = na
var int cLB = na
var bool cHU = true
var bool cLU = true
var int cTr = 0
var array<line> evL = array.new<line>()
var array<label> evT = array.new<label>()
if not na(cPh)
cH := cPh
cHB := bar_index - pivLen
cHU := false
if not na(cPl)
cL := cPl
cLB := bar_index - pivLen
cLU := false
if barstate.isconfirmed
upB = not na(cH) and not cHU and close > cH
dnB = not na(cL) and not cLU and close < cL
if upB or dnB
d = upB ? 1 : -1
lvl = upB ? cH : cL
x1 = upB ? cHB : cLB
isCh = cTr == -d
cTr := d
if upB
cHU := true
else
cLU := true
if showStr
c = d == 1 ? BULL : BEAR
array.push(evL, line.new(x1, lvl, bar_index, lvl, color = c, width = isCh ? 2 : 1, style = isCh ? line.style_solid : line.style_dashed))
array.push(evT, label.new(int(math.round((x1 + bar_index) / 2)), lvl, isCh ? "CHoCH" : "BOS", style = d == 1 ? label.style_label_down : label.style_label_up,
color = isCh ? c : color.new(PANEL, 100), textcolor = isCh ? (d == 1 ? INK : color.white) : c, size = size.small))
if array.size(evL) > keepEv
line.delete(array.shift(evL))
label.delete(array.shift(evT))
if showSwp
if not na(cH) and high > cH and close < cH
label.new(bar_index, high, "BSL ✕", style = label.style_label_down, color = color.new(PANEL, 100), textcolor = BEAR, size = size.small)
if not na(cL) and low < cL and close > cL
label.new(bar_index, low, "SSL ✕", style = label.style_label_up, color = color.new(PANEL, 100), textcolor = BULL, size = size.small)
var box pBx = na
var box dBx = na
var line eqL = na
if barstate.islast and showPD and not na(cH) and not na(cL) and cH > cL
box.delete(pBx)
box.delete(dBx)
line.delete(eqL)
x0 = math.min(cHB, cLB)
eq = (cH + cL) / 2
pBx := box.new(x0, cH, bar_index + 12, eq, border_color = color.new(BEAR, 70), bgcolor = color.new(BEAR, 93),
text = "PREMIUM", text_color = color.new(BEAR, 30), text_size = size.small, text_halign = text.align_left, text_valign = text.align_top)
dBx := box.new(x0, eq, bar_index + 12, cL, border_color = color.new(BULL, 70), bgcolor = color.new(BULL, 93),
text = "DISCOUNT", text_color = color.new(BULL, 30), text_size = size.small, text_halign = text.align_left, text_valign = text.align_bottom)
eqL := line.new(x0, eq, bar_index + 12, eq, color = color.new(ACC, 20), style = line.style_dotted, width = 1)
// ─────────────────────────────────────────────────────────────────────────
// THE MATRIX
// ─────────────────────────────────────────────────────────────────────────
shortName(string s) =>
parts = str.split(s, ":")
array.size(parts) > 1 ? array.get(parts, 1) : s
dirCol(int d) =>
d == 1 ? BULL : d == -1 ? BEAR : MUTE
// rank: a fresh CHoCH, price inside a block, a fresh sweep, a gap within reach
score(int ev, int ago, int ob, float obd, int fv, float fvd, int sw, int swa) =>
s = 0.0
s += not na(ago) and ago <= freshN ? (ev == 2 ? 4.0 : 2.0) : 0.0
s += ob != 0 and not na(obd) ? (obd == 0 ? 3.0 : obd <= nearAtr ? 1.5 : 0.0) : 0.0
s += not na(swa) and swa <= freshN ? 2.0 : 0.0
s += fv != 0 and not na(fvd) and fvd <= nearAtr ? 1.0 : 0.0
s
var table tb = na
cell(int c, int r, string t, color fg, color bg, string al = text.align_center) =>
table.cell(tb, c, r, t, text_color = fg, bgcolor = bg, text_size = tSize, text_halign = al)
if barstate.islast
syms = array.from(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15)
tr = array.from(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15)
ev = array.from(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15)
ag = array.from(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
ob = array.from(o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15)
obd = array.from(od1, od2, od3, od4, od5, od6, od7, od8, od9, od10, od11, od12, od13, od14, od15)
fv = array.from(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15)
fvd = array.from(fd1, fd2, fd3, fd4, fd5, fd6, fd7, fd8, fd9, fd10, fd11, fd12, fd13, fd14, fd15)
pd = array.from(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15)
sw = array.from(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15)
swa = array.from(wa1, wa2, wa3, wa4, wa5, wa6, wa7, wa8, wa9, wa10, wa11, wa12, wa13, wa14, wa15)
sc = array.new_float()
for i = 0 to 14
array.push(sc, score(array.get(ev, i), array.get(ag, i), array.get(ob, i), array.get(obd, i), array.get(fv, i), array.get(fvd, i), array.get(sw, i), array.get(swa, i)))
rank = array.sort_indices(sc, order.descending)
pos = tblPos == "Top Right" ? position.top_right : tblPos == "Middle Right" ? position.middle_right : tblPos == "Bottom Right" ? position.bottom_right : tblPos == "Top Left" ? position.top_left : position.bottom_left
table.delete(tb)
tb := table.new(pos, 6, rowsN + 2, bgcolor = PANEL, border_color = PANEL, border_width = 1, frame_color = color.new(ACC, 30), frame_width = 1)
cell(0, 0, "SMC SCREENER · " + timeframe.period, ACC, PANEL, text.align_left)
table.merge_cells(tb, 0, 0, 5, 0)
hdr = array.from("SYMBOL", "STRUCTURE", "ORDER BLOCK", "FVG", "ZONE", "SWEEP")
for c = 0 to 5
cell(c, 1, array.get(hdr, c), MUTE, ROW2, c == 0 ? text.align_left : text.align_center)
for k = 0 to rowsN - 1
i = array.get(rank, k)
r = k + 2
rb = k % 2 == 0 ? ROW : ROW2
t = array.get(tr, i)
e = array.get(ev, i)
a = array.get(ag, i)
o = array.get(ob, i)
od = array.get(obd, i)
f = array.get(fv, i)
fd = array.get(fvd, i)
p = array.get(pd, i)
w = array.get(sw, i)
wa = array.get(swa, i)
hot = array.get(sc, i) >= 3
cell(0, r, (hot ? "● " : " ") + shortName(array.get(syms, i)), hot ? TXT : MUTE, rb, text.align_left)
// structure
freshE = not na(a) and a <= freshN
stTxt = t == 0 or na(e) or e == 0 ? "—" : (t == 1 ? "▲ " : "▼ ") + (e == 2 ? "CHoCH" : "BOS") + " · " + str.tostring(a) + "b"
cell(1, r, stTxt, freshE ? (t == 1 ? INK : color.white) : dirCol(t), freshE and t != 0 ? dirCol(t) : rb)
// order block
obTxt = o == 0 or na(od) ? "—" : od == 0 ? (o == 1 ? "IN ▲ OB" : "IN ▼ OB") : (o == 1 ? "▲ " : "▼ ") + str.tostring(od, "0.0") + " ATR"
inOb = o != 0 and not na(od) and od == 0
cell(2, r, obTxt, inOb ? (o == 1 ? INK : color.white) : dirCol(o), inOb ? dirCol(o) : not na(od) and od <= nearAtr and o != 0 ? color.new(dirCol(o), 82) : rb)
// fair value gap
fvTxt = f == 0 or na(fd) ? "—" : fd == 0 ? (f == 1 ? "IN ▲ FVG" : "IN ▼ FVG") : (f == 1 ? "▲ " : "▼ ") + str.tostring(fd, "0.0") + " ATR"
cell(3, r, fvTxt, f != 0 and not na(fd) and fd <= nearAtr ? ACC : dirCol(f), f != 0 and not na(fd) and fd == 0 ? color.new(ACC, 75) : rb)
// premium / discount
pdTxt = na(p) ? "—" : p > 100 ? "ABOVE RANGE" : p < 0 ? "BELOW RANGE" : p >= 50 ? "PREMIUM " + str.tostring(p, "0") + "%" : "DISCOUNT " + str.tostring(p, "0") + "%"
cell(4, r, pdTxt, na(p) ? MUTE : p > 100 ? BULL : p < 0 ? BEAR : p >= 50 ? BEAR : BULL, rb)
// sweep
freshW = not na(wa) and wa <= freshN
swTxt = w == 0 or na(wa) ? "—" : (w == 1 ? "▲ SSL · " : "▼ BSL · ") + str.tostring(wa) + "b"
cell(5, r, swTxt, freshW ? (w == 1 ? INK : color.white) : dirCol(w), freshW and w != 0 ? dirCol(w) : rb)
// ─────────────────────────────────────────────────────────────────────────
// ALERTS — one message per bar listing every symbol with a new event
// ─────────────────────────────────────────────────────────────────────────
note(string s, bool hit, string what) =>
hit ? shortName(s) + " " + what + "\n" : ""
newChoch(int e, int a) =>
e == 2 and a == 0
newIn(int o, float d) =>
o != 0 and not na(d) and d == 0
if barstate.isconfirmed
mC = note(s1, newChoch(e1, a1), "CHoCH") + note(s2, newChoch(e2, a2), "CHoCH") + note(s3, newChoch(e3, a3), "CHoCH") + note(s4, newChoch(e4, a4), "CHoCH") + note(s5, newChoch(e5, a5), "CHoCH") + note(s6, newChoch(e6, a6), "CHoCH") + note(s7, newChoch(e7, a7), "CHoCH") + note(s8, newChoch(e8, a8), "CHoCH") + note(s9, newChoch(e9, a9), "CHoCH") + note(s10, newChoch(e10, a10), "CHoCH") + note(s11, newChoch(e11, a11), "CHoCH") + note(s12, newChoch(e12, a12), "CHoCH") + note(s13, newChoch(e13, a13), "CHoCH") + note(s14, newChoch(e14, a14), "CHoCH") + note(s15, newChoch(e15, a15), "CHoCH")
mS = note(s1, wa1 == 0, "liquidity sweep") + note(s2, wa2 == 0, "liquidity sweep") + note(s3, wa3 == 0, "liquidity sweep") + note(s4, wa4 == 0, "liquidity sweep") + note(s5, wa5 == 0, "liquidity sweep") + note(s6, wa6 == 0, "liquidity sweep") + note(s7, wa7 == 0, "liquidity sweep") + note(s8, wa8 == 0, "liquidity sweep") + note(s9, wa9 == 0, "liquidity sweep") + note(s10, wa10 == 0, "liquidity sweep") + note(s11, wa11 == 0, "liquidity sweep") + note(s12, wa12 == 0, "liquidity sweep") + note(s13, wa13 == 0, "liquidity sweep") + note(s14, wa14 == 0, "liquidity sweep") + note(s15, wa15 == 0, "liquidity sweep")
mO = note(s1, newIn(o1, od1) and not newIn(o1[1], od1[1]), "entered an order block") + note(s2, newIn(o2, od2) and not newIn(o2[1], od2[1]), "entered an order block") + note(s3, newIn(o3, od3) and not newIn(o3[1], od3[1]), "entered an order block") + note(s4, newIn(o4, od4) and not newIn(o4[1], od4[1]), "entered an order block") + note(s5, newIn(o5, od5) and not newIn(o5[1], od5[1]), "entered an order block") + note(s6, newIn(o6, od6) and not newIn(o6[1], od6[1]), "entered an order block") + note(s7, newIn(o7, od7) and not newIn(o7[1], od7[1]), "entered an order block") + note(s8, newIn(o8, od8) and not newIn(o8[1], od8[1]), "entered an order block") + note(s9, newIn(o9, od9) and not newIn(o9[1], od9[1]), "entered an order block") + note(s10, newIn(o10, od10) and not newIn(o10[1], od10[1]), "entered an order block") + note(s11, newIn(o11, od11) and not newIn(o11[1], od11[1]), "entered an order block") + note(s12, newIn(o12, od12) and not newIn(o12[1], od12[1]), "entered an order block") + note(s13, newIn(o13, od13) and not newIn(o13[1], od13[1]), "entered an order block") + note(s14, newIn(o14, od14) and not newIn(o14[1], od14[1]), "entered an order block") + note(s15, newIn(o15, od15) and not newIn(o15[1], od15[1]), "entered an order block")
if alChoch and mC != ""
alert("SMC Screener " + timeframe.period + "\n" + mC, alert.freq_once_per_bar_close)
if alOb and mO != ""
alert("SMC Screener " + timeframe.period + "\n" + mO, alert.freq_once_per_bar_close)
if alSw and mS != ""
alert("SMC Screener " + timeframe.period + "\n" + mS, alert.freq_once_per_bar_close)
// ─────────────────────────────────────────────────────────────────────────
// GLOW CANDLES (LunqFX house style)
// ─────────────────────────────────────────────────────────────────────────
GLOW_UP_DARK = #2DD4BF
GLOW_DN_DARK = #F87171
GLOW_UP_LIGHT = #0D9488
GLOW_DN_LIGHT = #DC2626
glowUp = isLight ? GLOW_UP_LIGHT : GLOW_UP_DARK
glowDn = isLight ? GLOW_DN_LIGHT : GLOW_DN_DARK
glowEdge = close >= open ? glowUp : glowDn
glowOn = candOn_ and candGlw
GLOW_NONE = color.new(color.black, 100)
plotcandle(candOn_ and not glowOn ? open : na, high, low, close, "Candles", color = color.new(glowEdge, 24), wickcolor = color.new(glowEdge, 18), bordercolor = glowEdge, display = display.pane)
gQ = (close - open) / 4.0
plotcandle(glowOn ? open : na, glowOn ? math.max(open, close) : na, glowOn ? math.min(open, close) : na, glowOn ? close : na, "Glow mask", color = chart.bg_color, wickcolor = GLOW_NONE, bordercolor = chart.bg_color, display = display.pane)
plotcandle(glowOn ? open : na, glowOn ? math.max(open, open + gQ) : na, glowOn ? math.min(open, open + gQ) : na, glowOn ? open + gQ : na, "Glow band 1", color = color.new(glowEdge, 78), wickcolor = GLOW_NONE, bordercolor = GLOW_NONE, display = display.pane)
plotcandle(glowOn ? open + gQ : na, glowOn ? math.max(open + gQ, open + 2 * gQ) : na, glowOn ? math.min(open + gQ, open + 2 * gQ) : na, glowOn ? open + 2 * gQ : na, "Glow band 2", color = color.new(glowEdge, 58), wickcolor = GLOW_NONE, bordercolor = GLOW_NONE, display = display.pane)
plotcandle(glowOn ? open + 2 * gQ : na, glowOn ? math.max(open + 2 * gQ, open + 3 * gQ) : na, glowOn ? math.min(open + 2 * gQ, open + 3 * gQ) : na, glowOn ? open + 3 * gQ : na, "Glow band 3", color = color.new(glowEdge, 36), wickcolor = GLOW_NONE, bordercolor = GLOW_NONE, display = display.pane)
plotcandle(glowOn ? open + 3 * gQ : na, glowOn ? math.max(open + 3 * gQ, close) : na, glowOn ? math.min(open + 3 * gQ, close) : na, glowOn ? close : na, "Glow band 4", color = color.new(glowEdge, 8), wickcolor = GLOW_NONE, bordercolor = GLOW_NONE, display = display.pane)
plotcandle(glowOn ? open : na, glowOn ? high : na, glowOn ? low : na, glowOn ? close : na, "Glow wick", color = GLOW_NONE, wickcolor = color.new(glowEdge, 10), bordercolor = color.new(glowEdge, 30), display = display.pane)