本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Key Levels and Sessions Coach [TheTrendTutor]", shorttitle = "Key Levels Coach", overlay = true, max_lines_count = 50, max_labels_count = 500, max_boxes_count = 500)
// ═════════════════════════ LANGUAGE ═════════════════════════
string G_LANG = "Language"
string lang = input.string("English", "Language", options = ["English", "Bahasa Indonesia", "Deutsch", "Español", "Français", "Kurdî Kurmancî", "Português", "Tiếng Việt", "Türkçe", "Русский", "中文"], group = G_LANG)
int li = switch lang
"Bahasa Indonesia" => 1
"Deutsch" => 2
"Español" => 3
"Français" => 4
"Kurdî Kurmancî" => 5
"Português" => 6
"Tiếng Việt" => 7
"Türkçe" => 8
"Русский" => 9
"中文" => 10
=> 0
tr(string s) =>
array<string> parts = str.split(s, "|")
parts.size() > li ? parts.get(li) : parts.get(0)
// Order: English | Bahasa Indonesia | Deutsch | Español | Français | Kurdî Kurmancî | Português | Tiếng Việt | Türkçe | Русский | 中文
string K_TITLE = "KEY LEVELS COACH|PELATIH LEVEL KUNCI|KEY-LEVEL-COACH|COACH DE NIVELES CLAVE|COACH DES NIVEAUX CLÉS|RAHÊNERÊ ASTÊN SEREKE|COACH DE NÍVEIS-CHAVE|HUẤN LUYỆN MỨC GIÁ QUAN TRỌNG|KİLİT SEVİYE KOÇU|ТРЕНЕР КЛЮЧЕВЫХ УРОВНЕЙ|关键价位教练"
string K_DAY = "Yesterday|Kemarin|Gestern|Ayer|Hier|Duh|Ontem|Hôm qua|Dün|Вчера|昨日"
string K_WEEK = "Last week|Minggu lalu|Letzte Woche|Semana pasada|Semaine passée|Hefteya borî|Semana passada|Tuần trước|Geçen hafta|Прошлая неделя|上周"
string K_BIAS = "Intraday bias|Bias harian|Intraday-Tendenz|Sesgo intradía|Biais intraday|Meyla rojane|Viés intradiário|Xu hướng trong ngày|Gün içi yön|Внутридневной уклон|日内倾向"
string K_RES = "Nearest resistance|Resistance terdekat|Nächster Widerstand|Resistencia más cercana|Résistance la plus proche|Berxwedana herî nêzîk|Resistência mais próxima|Kháng cự gần nhất|En yakın direnç|Ближайшее сопротивление|最近阻力"
string K_SUP = "Nearest support|Support terdekat|Nächste Unterstützung|Soporte más cercano|Support le plus proche|Piştgiriya herî nêzîk|Suporte mais próximo|Hỗ trợ gần nhất|En yakın destek|Ближайшая поддержка|最近支撑"
string K_SESS = "Open sessions|Sesi aktif|Offene Sessions|Sesiones abiertas|Sessions ouvertes|Danişînên vekirî|Sessões abertas|Phiên đang mở|Açık seanslar|Открытые сессии|开盘时段"
string K_NONE = "None|Tidak ada|Keine|Ninguna|Aucune|Tune|Nenhuma|Không có|Yok|Нет|无"
string K_ABOVE = "Above high: breakout zone, watch the retest|Di atas high: zona breakout, perhatikan retest|Über dem Hoch: Ausbruchszone, auf Retest achten|Sobre el máximo: zona de ruptura, vigila el retest|Au-dessus du plus haut : zone de cassure, surveillez le retest|Li ser bilindahiyê: qada şikandinê, li retestê binêre|Acima da máxima: zona de rompimento, observe o reteste|Trên đỉnh: vùng phá vỡ, chờ kiểm định lại|Zirvenin üstünde: kırılım bölgesi, geri testi izle|Выше максимума: зона пробоя, следите за ретестом|高于高点:突破区,关注回踩"
string K_BELOW = "Below low: breakdown zone, watch the retest|Di bawah low: zona breakdown, perhatikan retest|Unter dem Tief: Abbruchzone, auf Retest achten|Bajo el mínimo: zona de caída, vigila el retest|Sous le plus bas : zone de cassure baissière, surveillez le retest|Li bin nizmahiyê: qada şikandina jêr, li retestê binêre|Abaixo da mínima: zona de queda, observe o reteste|Dưới đáy: vùng phá vỡ giảm, chờ kiểm định lại|Dibin altında: aşağı kırılım bölgesi, geri testi izle|Ниже минимума: зона пробоя вниз, следите за ретестом|低于低点:跌破区,关注回抽"
string K_INSIDE = "Inside range: edges are key|Di dalam range: tepian adalah kunci|Innerhalb der Range: Ränder sind entscheidend|Dentro del rango: los bordes son clave|Dans le range : les bords sont clés|Di nav rêzê de: qirax girîng in|Dentro do range: as bordas são chave|Trong vùng giá: các biên là then chốt|Aralık içinde: kenarlar kilit|Внутри диапазона: важны границы|区间内:边缘是关键"
string K_BULL = "Bullish (above daily open)|Bullish (di atas open harian)|Bullisch (über Tageseröffnung)|Alcista (sobre la apertura diaria)|Haussier (au-dessus de l'ouverture)|Bilindbûn (li ser vekirina rojê)|Altista (acima da abertura diária)|Tăng (trên giá mở cửa ngày)|Yükseliş (günlük açılışın üstünde)|Бычий (выше дневного открытия)|看涨(高于日开盘价)"
string K_BEAR = "Bearish (below daily open)|Bearish (di bawah open harian)|Bärisch (unter Tageseröffnung)|Bajista (bajo la apertura diaria)|Baissier (sous l'ouverture)|Daketin (li bin vekirina rojê)|Baixista (abaixo da abertura diária)|Giảm (dưới giá mở cửa ngày)|Düşüş (günlük açılışın altında)|Медвежий (ниже дневного открытия)|看跌(低于日开盘价)"
string K_OVERLAP = "London + New York overlap: peak volatility|Overlap London + New York: volatilitas puncak|London + New York Überschneidung: höchste Volatilität|Solapamiento Londres + Nueva York: volatilidad máxima|Chevauchement Londres + New York : volatilité maximale|Hevdemiya London + New York: bilindtirîn tevgerbûn|Sobreposição Londres + Nova York: volatilidade máxima|Giao phiên London + New York: biến động cao nhất|Londra + New York çakışması: en yüksek oynaklık|Пересечение Лондона и Нью-Йорка: пик волатильности|伦敦 + 纽约重叠:波动最高"
string K_TIP = "Levels are zones, not exact lines. Wait for a candle close.|Level adalah zona, bukan garis pasti. Tunggu penutupan candle.|Levels sind Zonen, keine exakten Linien. Warte auf den Kerzenschluss.|Los niveles son zonas, no líneas exactas. Espera el cierre de la vela.|Les niveaux sont des zones, pas des lignes exactes. Attendez la clôture.|Ast herêm in, ne xetên teqez. Li girtina mûmê bisekine.|Níveis são zonas, não linhas exatas. Espere o fechamento do candle.|Mức giá là vùng, không phải đường chính xác. Hãy chờ nến đóng cửa.|Seviyeler kesin çizgi değil, bölgedir. Mum kapanışını bekle.|Уровни - это зоны, а не точные линии. Ждите закрытия свечи.|价位是区域,不是精确的线。等待K线收盘。"
string K_DISC = "Educational tool, not financial advice.|Alat edukasi, bukan saran keuangan.|Lernwerkzeug, keine Finanzberatung.|Herramienta educativa, no es asesoramiento financiero.|Outil éducatif, pas un conseil financier.|Amûrek perwerdeyî ye, ne şîreta darayî ye.|Ferramenta educacional, não é aconselhamento financeiro.|Công cụ giáo dục, không phải lời khuyên tài chính.|Eğitim aracıdır, yatırım tavsiyesi değildir.|Обучающий инструмент, не финансовый совет.|教育工具,非投资建议。"
string K_SWEEP_H = "Sweep of high|Sweep high|Hoch-Sweep|Barrido del máximo|Balayage du haut|Paqijkirina bilindahiyê|Varredura da máxima|Quét đỉnh|Zirve süpürme|Снятие максимума|扫高点"
string K_SWEEP_L = "Sweep of low|Sweep low|Tief-Sweep|Barrido del mínimo|Balayage du bas|Paqijkirina nizmahiyê|Varredura da mínima|Quét đáy|Dip süpürme|Снятие минимума|扫低点"
string K_ASIA = "Asia|Asia|Asien|Asia|Asie|Asya|Ásia|Châu Á|Asya|Азия|亚洲"
string K_LON = "London|London|London|Londres|Londres|London|Londres|London|Londra|Лондон|伦敦"
string K_NY = "New York|New York|New York|Nueva York|New York|New York|Nova York|New York|New York|Нью-Йорк|纽约"
// ═════════════════════════ INPUTS ═════════════════════════
string G_LV = "Key levels"
bool showD = input.bool(true, "Previous day high / low (PDH / PDL)", group = G_LV)
bool showDO = input.bool(true, "Daily open (DO)", group = G_LV)
bool showW = input.bool(true, "Previous week high / low (PWH / PWL)", group = G_LV)
bool showM = input.bool(true, "Previous month high / low (PMH / PML)", group = G_LV)
bool showRN = input.bool(true, "Round numbers", group = G_LV)
float rnStepIn = input.float(0.0, "Round number step (0 = auto)", minval = 0.0, group = G_LV)
int extR = input.int(15, "Extend lines to the right (bars)", minval = 1, maxval = 200, group = G_LV)
bool showPrice = input.bool(true, "Show prices on labels", group = G_LV)
color colD = input.color(#2962FF, "Day color", group = G_LV)
color colDO = input.color(#FF9800, "Daily open color", group = G_LV)
color colW = input.color(#9C27B0, "Week color", group = G_LV)
color colM = input.color(#E91E63, "Month color", group = G_LV)
color colRN = input.color(color.new(#787B86, 30), "Round number color", group = G_LV)
string G_FIT = "Fit to window"
bool fitOn = input.bool(true, "Hide levels far from the visible chart", group = G_FIT, tooltip = "Keeps the price scale tight so candles fill the window. Hidden levels are still listed in the coach panel.")
float fitPad = input.float(10, "Extra margin (% of visible range)", minval = 0, maxval = 100, group = G_FIT)
string G_SS = "Sessions and markers"
bool showS = input.bool(true, "Show session boxes (1h and lower)", group = G_SS)
int histDays = input.int(3, "History to show (days)", minval = 1, maxval = 30, group = G_SS, tooltip = "Session boxes and sweep markers older than this are removed to keep the chart clean.")
string sAsia = input.session("0900-1800", "Asia (Tokyo time)", group = G_SS)
string sLon = input.session("0800-1700", "London (London time)", group = G_SS)
string sNY = input.session("0800-1700", "New York (New York time)", group = G_SS)
color cAsia = input.color(#00BCD4, "Asia color", group = G_SS)
color cLon = input.color(#4CAF50, "London color", group = G_SS)
color cNY = input.color(#FF5252, "New York color", group = G_SS)
string G_CO = "Coach"
bool showSweep = input.bool(true, "Mark liquidity sweeps of PDH / PDL", group = G_CO)
bool showPanel = input.bool(true, "Show coach panel", group = G_CO)
string panelPos = input.string("Auto", "Panel position", options = ["Auto", "Top right", "Top left", "Bottom right", "Bottom left"], group = G_CO, tooltip = "Auto moves the panel to the free corner on the right, away from the current price and nearby levels.")
string panelSz = input.string("Small", "Panel text size", options = ["Tiny", "Small", "Normal"], group = G_CO)
// ═════════════════════════ DATA ═════════════════════════
[pdh, pdl, dOpen] = request.security(syminfo.tickerid, "D", [high[1], low[1], open], lookahead = barmerge.lookahead_on)
[pwh, pwl] = request.security(syminfo.tickerid, "W", [high[1], low[1]], lookahead = barmerge.lookahead_on)
[pmh, pml] = request.security(syminfo.tickerid, "M", [high[1], low[1]], lookahead = barmerge.lookahead_on)
int tfSec = timeframe.in_seconds()
bool okD = tfSec < 86400
bool okW = tfSec < 604800
bool okM = tfSec < 2419200
bool isIntra = timeframe.isintraday
bool sessTf = isIntra and tfSec <= 3600
int histMs = histDays * 86400000
var int dStart = na
var int wStart = na
var int mStart = na
if timeframe.change("D")
dStart := bar_index
if timeframe.change("W")
wStart := bar_index
if timeframe.change("M")
mStart := bar_index
color cUp = #26A69A
color cDn = #EF5350
color cNeu = #D1D4DC
color cTr = color.new(color.black, 100)
// ═════════════════════════ VISIBLE RANGE (fit to window) ═════════════════════════
bool inView = time >= chart.left_visible_bar_time and time <= chart.right_visible_bar_time
var float visHi = na
var float visLo = na
if inView
visHi := na(visHi) ? high : math.max(visHi, high)
visLo := na(visLo) ? low : math.min(visLo, low)
fits(float y) =>
float pad = (visHi - visLo) * fitPad / 100
not fitOn or na(pad) or (y <= visHi + pad and y >= visLo - pad)
// ═════════════════════════ LEVEL LINES ═════════════════════════
var line lPDH = line.new(bar_index, na, bar_index, na, color = colD, width = 2)
var line lPDL = line.new(bar_index, na, bar_index, na, color = colD, width = 2)
var line lDO = line.new(bar_index, na, bar_index, na, color = colDO, width = 1, style = line.style_dashed)
var line lPWH = line.new(bar_index, na, bar_index, na, color = colW, width = 2)
var line lPWL = line.new(bar_index, na, bar_index, na, color = colW, width = 2)
var line lPMH = line.new(bar_index, na, bar_index, na, color = colM, width = 3)
var line lPML = line.new(bar_index, na, bar_index, na, color = colM, width = 3)
var label bPDH = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colD, size = size.small)
var label bPDL = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colD, size = size.small)
var label bDO = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colDO, size = size.small)
var label bPWH = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colW, size = size.small)
var label bPWL = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colW, size = size.small)
var label bPMH = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colM, size = size.small)
var label bPML = label.new(bar_index, na, "", style = label.style_label_left, color = cTr, textcolor = colM, size = size.small)
var line rn1 = line.new(bar_index, na, bar_index, na, color = colRN, style = line.style_dotted)
var line rn2 = line.new(bar_index, na, bar_index, na, color = colRN, style = line.style_dotted)
var line rn3 = line.new(bar_index, na, bar_index, na, color = colRN, style = line.style_dotted)
var line rn4 = line.new(bar_index, na, bar_index, na, color = colRN, style = line.style_dotted)
placeLevel(line ln, label lb, int x1, float y, string name, bool on, array<float> ys, array<line> lns, array<label> lbs) =>
if on and not na(y) and fits(y)
int xs = na(x1) ? bar_index - 50 : math.max(x1, bar_index - 4900)
line.set_xy1(ln, xs, y)
line.set_xy2(ln, bar_index + extR, y)
label.set_xy(lb, bar_index + extR, y)
label.set_text(lb, showPrice ? name + " " + str.tostring(y, format.mintick) : name)
ys.push(y)
lns.push(ln)
lbs.push(lb)
else
line.set_y1(ln, na)
line.set_y2(ln, na)
label.set_y(lb, na)
setRN(line ln, float y) =>
if fits(y)
line.set_xy1(ln, bar_index - 100, y)
line.set_xy2(ln, bar_index + extR, y)
else
line.set_y1(ln, na)
line.set_y2(ln, na)
if barstate.islast
array<float> ys = array.new<float>()
array<line> lns = array.new<line>()
array<label> lbs = array.new<label>()
placeLevel(lPDH, bPDH, dStart, pdh, "PDH", showD and okD, ys, lns, lbs)
placeLevel(lPDL, bPDL, dStart, pdl, "PDL", showD and okD, ys, lns, lbs)
placeLevel(lDO, bDO, dStart, dOpen, "DO", showDO and okD, ys, lns, lbs)
placeLevel(lPWH, bPWH, wStart, pwh, "PWH", showW and okW, ys, lns, lbs)
placeLevel(lPWL, bPWL, wStart, pwl, "PWL", showW and okW, ys, lns, lbs)
placeLevel(lPMH, bPMH, mStart, pmh, "PMH", showM and okM, ys, lns, lbs)
placeLevel(lPML, bPML, mStart, pml, "PML", showM and okM, ys, lns, lbs)
// stagger labels that sit too close to each other
if ys.size() > 1
float minGap = na(visHi) ? close * 0.004 : (visHi - visLo) * 0.03
array<int> idx = ys.sort_indices(order.ascending)
int off = 0
float prevY = na
for k = 0 to idx.size() - 1
int j = idx.get(k)
float y = ys.get(j)
off := not na(prevY) and y - prevY < minGap ? (off + 1) % 3 : 0
int xl = bar_index + extR + off * 14
label.set_x(lbs.get(j), xl)
line.set_x2(lns.get(j), xl)
prevY := y
if showRN and close > 0
float stp = rnStepIn > 0 ? rnStepIn : math.pow(10, math.floor(math.log10(close)) - (close >= 1000 ? 1 : 2))
float base = math.floor(close / stp) * stp
setRN(rn1, base - stp)
setRN(rn2, base)
setRN(rn3, base + stp)
setRN(rn4, base + 2 * stp)
// ═════════════════════════ LIQUIDITY SWEEPS ═════════════════════════
bool sweepHi = okD and high > pdh and close < pdh
bool sweepLo = okD and low < pdl and close > pdl
var bool sweptH = false
var bool sweptL = false
if timeframe.change("D")
sweptH := false
sweptL := false
var array<label> swL = array.new<label>()
var array<int> swT = array.new<int>()
while swT.size() > 0 and time - swT.first() > histMs
label.delete(swL.shift())
swT.shift()
if showSweep and barstate.isconfirmed
if sweepHi and not sweptH
sweptH := true
swL.push(label.new(bar_index, high, tr(K_SWEEP_H), style = label.style_label_down, color = color.new(cDn, 15), textcolor = color.white, size = size.tiny))
swT.push(time)
if sweepLo and not sweptL
sweptL := true
swL.push(label.new(bar_index, low, tr(K_SWEEP_L), style = label.style_label_up, color = color.new(cUp, 15), textcolor = color.white, size = size.tiny))
swT.push(time)
// ═════════════════════════ SESSIONS ═════════════════════════
type SessState
box bx
float hi
float lo
bool active = false
array<box> bxs
array<int> tms
pruneSess(SessState s) =>
while s.tms.size() > 0 and time - s.tms.first() > histMs
box.delete(s.bxs.shift())
s.tms.shift()
s.tms.size()
procSess(SessState s, bool inS, color c, string key) =>
if inS
if not s.active
s.active := true
s.hi := high
s.lo := low
s.bx := box.new(bar_index, high, bar_index, low, border_color = color.new(c, 50), bgcolor = color.new(c, 92), text = tr(key), text_color = color.new(c, 20), text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_top)
s.bxs.push(s.bx)
s.tms.push(time)
else
s.hi := math.max(s.hi, high)
s.lo := math.min(s.lo, low)
box.set_top(s.bx, s.hi)
box.set_bottom(s.bx, s.lo)
box.set_right(s.bx, bar_index)
else if s.active
s.active := false
s.active
var SessState stA = SessState.new(bxs = array.new<box>(), tms = array.new<int>())
var SessState stL = SessState.new(bxs = array.new<box>(), tms = array.new<int>())
var SessState stN = SessState.new(bxs = array.new<box>(), tms = array.new<int>())
bool inA = not na(time(timeframe.period, sAsia, "Asia/Tokyo"))
bool inL = not na(time(timeframe.period, sLon, "Europe/London"))
bool inN = not na(time(timeframe.period, sNY, "America/New_York"))
if showS and sessTf
pruneSess(stA)
pruneSess(stL)
pruneSess(stN)
procSess(stA, inA, cAsia, K_ASIA)
procSess(stL, inL, cLon, K_LON)
procSess(stN, inN, cNY, K_NY)
// ═════════════════════════ COACH PANEL ═════════════════════════
string tSize = switch panelSz
"Tiny" => size.tiny
"Normal" => size.normal
=> size.small
var table panel = na
cellL(int r, string t) =>
table.cell(panel, 0, r, t, text_color = #9598A1, text_halign = text.align_left, text_size = tSize)
cellR(int r, string t, color c) =>
table.cell(panel, 1, r, t, text_color = c, text_halign = text.align_left, text_size = tSize)
posTxt(float hi, float lo) =>
close > hi ? tr(K_ABOVE) : close < lo ? tr(K_BELOW) : tr(K_INSIDE)
posCol(float hi, float lo) =>
close > hi ? cUp : close < lo ? cDn : cNeu
fmtLvl(string n, float v) =>
n + " " + str.tostring(v, format.mintick) + " (" + str.tostring((v - close) / close * 100, "+0.00;-0.00") + "%)"
if barstate.islast and showPanel
// panel position: Auto = free corner on the right, away from current price
bool priceHigh = not na(visHi) and close > (visHi + visLo) / 2
string tPos = switch panelPos
"Top right" => position.top_right
"Top left" => position.top_left
"Bottom right" => position.bottom_right
"Bottom left" => position.bottom_left
=> priceHigh ? position.bottom_right : position.top_right
if not na(panel)
table.delete(panel)
panel := table.new(tPos, 2, 9, bgcolor = color.new(#131722, 5), border_color = #363A45, border_width = 1, frame_color = #363A45, frame_width = 1)
table.merge_cells(panel, 0, 0, 1, 0)
table.merge_cells(panel, 0, 7, 1, 7)
table.merge_cells(panel, 0, 8, 1, 8)
array<float> lv = array.new<float>()
array<string> nm = array.new<string>()
if okD
lv.push(pdh)
nm.push("PDH")
lv.push(pdl)
nm.push("PDL")
lv.push(dOpen)
nm.push("DO")
if okW
lv.push(pwh)
nm.push("PWH")
lv.push(pwl)
nm.push("PWL")
if okM
lv.push(pmh)
nm.push("PMH")
lv.push(pml)
nm.push("PML")
float up = na
string upN = ""
float dn = na
string dnN = ""
if lv.size() > 0
for i = 0 to lv.size() - 1
float v = lv.get(i)
if not na(v)
if v > close and (na(up) or v < up)
up := v
upN := nm.get(i)
if v < close and (na(dn) or v > dn)
dn := v
dnN := nm.get(i)
array<string> ss = array.new<string>()
if inA
ss.push(tr(K_ASIA))
if inL
ss.push(tr(K_LON))
if inN
ss.push(tr(K_NY))
string sTxt = not isIntra ? "-" : ss.size() > 0 ? array.join(ss, ", ") : tr(K_NONE)
table.cell(panel, 0, 0, "🎯 " + tr(K_TITLE) + " · " + syminfo.ticker, text_color = color.white, bgcolor = color.new(#2962FF, 20), text_size = tSize)
cellL(1, tr(K_DAY))
cellR(1, okD ? posTxt(pdh, pdl) : "-", okD ? posCol(pdh, pdl) : cNeu)
cellL(2, tr(K_WEEK))
cellR(2, okW ? posTxt(pwh, pwl) : "-", okW ? posCol(pwh, pwl) : cNeu)
cellL(3, tr(K_BIAS))
cellR(3, okD ? (close >= dOpen ? tr(K_BULL) : tr(K_BEAR)) : "-", okD ? (close >= dOpen ? cUp : cDn) : cNeu)
cellL(4, tr(K_RES))
cellR(4, na(up) ? "-" : fmtLvl(upN, up), cDn)
cellL(5, tr(K_SUP))
cellR(5, na(dn) ? "-" : fmtLvl(dnN, dn), cUp)
cellL(6, tr(K_SESS))
cellR(6, sTxt, cNeu)
bool overlap = isIntra and inL and inN
table.cell(panel, 0, 7, overlap ? "⚡ " + tr(K_OVERLAP) : "💡 " + tr(K_TIP), text_color = overlap ? #FFB74D : cNeu, text_halign = text.align_left, text_size = tSize)
table.cell(panel, 0, 8, tr(K_DISC), text_color = #787B86, text_halign = text.align_left, text_size = size.tiny)
// ═════════════════════════ ALERTS ═════════════════════════
alertcondition(ta.crossover(close, pdh), "Cross above PDH", "{{ticker}} crossed above the previous day high")
alertcondition(ta.crossunder(close, pdl), "Cross below PDL", "{{ticker}} crossed below the previous day low")
alertcondition(ta.crossover(close, pwh), "Cross above PWH", "{{ticker}} crossed above the previous week high")
alertcondition(ta.crossunder(close, pwl), "Cross below PWL", "{{ticker}} crossed below the previous week low")
alertcondition(ta.cross(close, dOpen), "Daily open cross", "{{ticker}} crossed the daily open")
alertcondition(sweepHi, "PDH liquidity sweep", "{{ticker}} swept the previous day high and closed back below")
alertcondition(sweepLo, "PDL liquidity sweep", "{{ticker}} swept the previous day low and closed back above")