Asia Session | Killzone & Liquidity | ITC Concept

muhammedbilalmhd · study · 476 行 · 点赞 16 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator("Asia Session | Killzone & Liquidity | ITC Concept", shorttitle = "Asia Session | Killzone & Liquidity | ITC Concept", overlay = true, max_boxes_count = 200, max_lines_count = 500, max_labels_count = 500)
 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// =====================================================================================
//  Asia Session & Liquidity Candles + Bias  ·  v2.4
//  v2.4 Session status under the bias: what is active now (killzone, Asia, London,
//       New York, liquidity candle or no trade time) and a countdown to the next one.
//  v2.3 Bias and countdown are the same on every chart timeframe (Daily and 4H charts
//       used to show an old 1H bias and the wrong countdown).
//
//  1. Asia range box (17:00 – 00:15 New York time).
//  2. $$$ marks on the high and low of two one-hour liquidity candles after Asia
//     (the Frankfurt candle and the candle before the New York session).
//  3. Bias box: Daily, 4H and 1H market structure and the bias to trade, with a
//     countdown to the next possible update of each timeframe.
//
//  Times in Indian time (IST):
//                 Asia range              Liquidity candles
//    Summer       2:30 – 9:30 candles     10:30 AM and 4:30 PM
//    Winter       3:30 – 10:30 candles    11:30 AM and 5:30 PM
//
//  Season = Auto follows the US clock change by itself. Summer / Winter force one.
//
//  Alerts (create one alert with "Any alert() function call"):
//    Asia session, Frankfurt and New York liquidity candles, London killzone,
//    London trading time and New York trading time, each on open and close.
//    London trading time 02:00 – 05:00 and New York trading time 08:00 – 12:00
//    New York time (summer IST: 11:30 AM – 2:30 PM and 5:30 PM – 9:30 PM).
//    Early warning: a reminder a set number of minutes (default 10) before each one.
//
//  Bias (closed candles only, swings read from closing prices):
//    Daily / 4H : direction of the latest close through the most recent swing high
//                 or low (internal breaks count).
//    1H         : major structure only. BOS = close beyond the highest high / lowest
//                 low since the last break. CHoCH = close beyond the point where the
//                 breaking move started.
//    Trade      : Daily and 4H agree → that direction. Otherwise the 1H decides.
// =====================================================================================
 
G1 = "Session"
season    = input.string("Auto", "Season", options = ["Auto", "Summer", "Winter"], group = G1, tooltip = "Auto: switches by itself when the US clocks change (winter starts first Sunday of November, ends second Sunday of March).\nSummer: Asia 2:30 – 9:45 IST, liquidity candles 10:30 AM and 4:30 PM IST.\nWinter: everything one hour later. Asia 3:30 – 10:45 IST, liquidity candles 11:30 AM and 5:30 PM IST.")
startDate = input.time(timestamp("01 Sep 2026 00:00 +0000"), "Show from date", group = G1, tooltip = "Pick a date in the calendar. Nothing is drawn before it.")
maxTF     = input.int(60, "Max timeframe to display (minutes)", minval = 1, maxval = 1440, group = G1)
 
G2 = "Asia range"
showBox = input.bool(true, "Display Asia range", group = G2)
boxCol  = input.color(color.new(#B2B5BE, 75), "Asia range colour", group = G2)
 
G3 = "Liquidity candles"
showLiq = input.bool(true, "Mark $$$ on the high and low of the liquidity candles", group = G3)
liqCol  = input.color(#787B86, "Line & text colour", group = G3)
liqLine = input.bool(false, "Draw a line through the $$$", group = G3)
liqGap  = input.float(0.15, "Gap between candle and $$$ (× ATR)", minval = 0, step = 0.05, group = G3)
txtSz   = input.string(size.tiny, "Text size", options = [size.tiny, size.small, size.normal], group = G3)
 
G4 = "Bias"
showBias = input.bool(true, "Show bias box", group = G4)
biasPos  = input.string("Top right", "Position", options = ["Top right", "Top left", "Bottom right", "Bottom left"], group = G4)
lineSw   = input.bool(true, "Read swings from the line chart (closing prices)", group = G4, tooltip = "On: swings come from closing prices, as on a line chart. Off: swings are read from candle bodies.")
swLen    = input.int(1, "1H swing size (candles each side)", minval = 1, maxval = 10, group = G4, tooltip = "1H bias needs a major BOS or CHOCH. A bigger number ignores smaller swings.")
biasCol  = input.color(#787B86, "Text colour", group = G4)
buyCol   = input.color(#089981, "Buy", group = G4, inline = "bc")
sellCol  = input.color(#F23645, "Sell", group = G4, inline = "bc")
showSt   = input.bool(true, "Show session status (now / next)", group = G4)
boxSz    = input.string(size.small, "Box text size", options = [size.tiny, size.small, size.normal], group = G4)
 
G5 = "Alerts"
alAsia = input.bool(true, "Asia session open / close", group = G5)
alLiq  = input.bool(true, "Liquidity candles open / close", group = G5)
alLdn  = input.bool(true, "London killzone and trading time open / close", group = G5, tooltip = "Killzone 02:00 – 03:00 and trading time 02:00 – 05:00 New York time (summer: 11:30 AM – 12:30 PM and 11:30 AM – 2:30 PM IST).")
alPre  = input.bool(true, "Early warning before each event", group = G5, tooltip = "A reminder before each session, killzone, liquidity candle and trading time opens or closes. Works on any chart timeframe while price is moving.")
preMin = input.int(10, "Minutes before", minval = 1, maxval = 120, group = G5)
alNy   = input.bool(true, "New York session and trading time open / close", group = G5, tooltip = "Trading time 08:00 – 12:00 New York time (summer: 5:30 PM – 9:30 PM IST, winter: 6:30 PM – 10:30 PM IST).")
 
// ─────────────────────────── Session times ───────────────────────────
// Auto uses New York time, so daylight saving is handled by the exchange calendar.
// Summer / Winter use fixed UTC times (New York summer = UTC-4, winter = UTC-5).
bool   isAuto = season == "Auto"
bool   isSum  = season == "Summer"
string tz     = isAuto ? "America/New_York" : "UTC"
string sAsia  = isAuto ? "1700-0015" : isSum ? "2100-0415" : "2200-0515"
string sLiq1  = isAuto ? "0100-0200" : isSum ? "0500-0600" : "0600-0700"
string sLiq2  = isAuto ? "0700-0800" : isSum ? "1100-1200" : "1200-1300"
 
bool canShow = timeframe.isintraday and timeframe.in_seconds() <= maxTF * 60 and time >= startDate
 
inS(string s) =>
    not na(time(timeframe.period, s, tz))
 
// ─────────────────────────── Asia range box ───────────────────────────
bool inAsia = inS(sAsia)
var box   aBox = na
var float aHi  = na
var float aLo  = na
 
if inAsia and not inAsia[1]
    aHi  := high
    aLo  := low
    aBox := canShow and showBox ? box.new(time, high, time, low, xloc = xloc.bar_time, bgcolor = boxCol, border_color = boxCol) : na
else if inAsia
    aHi := math.max(aHi, high)
    aLo := math.min(aLo, low)
    if not na(aBox)
        box.set_top(aBox, aHi)
        box.set_bottom(aBox, aLo)
        box.set_right(aBox, time)
 
// ─────────────────────────── Liquidity candles ───────────────────────────
// The one-hour candle starting at the liquidity time. On charts below 1H the high
// and low of that whole hour are used, so the marks match the 1H candle.
f_liq(string s, float gap) =>
    bool inW = inS(s)
    var float h   = na
    var float l   = na
    var line  lnH = na
    var line  lnL = na
    var label lbH = na
    var label lbL = na
    if inW and not inW[1]
        // the liquidity candle has just opened: draw the marks straight away
        h := high
        l := low
        if canShow and showLiq
            // centred on the candle, one candle wide on each side, $$$ in the middle
            int barMs = timeframe.in_seconds() * 1000
            int xm    = time + int((3600000 - barMs) / 2)
            int half  = 3600000 + int((3600000 - barMs) / 2)
            color lbBg = liqLine ? chart.bg_color : color.new(chart.bg_color, 100)
            lnH := liqLine ? line.new(xm - half, h + gap, xm + half, h + gap, xloc = xloc.bar_time, color = liqCol, width = 1) : na
            lnL := liqLine ? line.new(xm - half, l - gap, xm + half, l - gap, xloc = xloc.bar_time, color = liqCol, width = 1) : na
            lbH := label.new(xm, h + gap, "$$$", xloc = xloc.bar_time, style = label.style_label_center, color = lbBg, textcolor = liqCol, size = txtSz)
            lbL := label.new(xm, l - gap, "$$$", xloc = xloc.bar_time, style = label.style_label_center, color = lbBg, textcolor = liqCol, size = txtSz)
        else
            lnH := na
            lnL := na
            lbH := na
            lbL := na
    else if inW
        h := math.max(h, high)
        l := math.min(l, low)
    // while the candle is open, the marks follow its high and low
    if inW and not na(lbH)
        label.set_y(lbH, h + gap)
        label.set_y(lbL, l - gap)
        if not na(lnH)
            line.set_y1(lnH, h + gap)
            line.set_y2(lnH, h + gap)
            line.set_y1(lnL, l - gap)
            line.set_y2(lnL, l - gap)
 
float gapNow = ta.atr(14) * liqGap
f_liq(sLiq1, gapNow)
f_liq(sLiq2, gapNow)
 
// ─────────────────────────── Bias ───────────────────────────
// Bodies only, closed candles only.
// 1H: major structure (IMG 1.3-01). BOS = body close beyond the highest swing high /
//     lowest swing low since the last break. CHOCH = body close beyond the protected
//     swing, which is where the breaking move started.
// Daily and 4H: internal BOS is valid. Direction of the latest body close through the
//     most recent swing high or swing low.
// Daily and 4H agree → that is the bias. Otherwise the 1H bias decides.
f_trendMajor(int len) =>
    float hs = lineSw ? close : math.max(open, close)
    float ls = lineSw ? close : math.min(open, close)
    float pH = ta.pivothigh(hs, len, len)
    float pL = ta.pivotlow(ls, len, len)
    float loK = ta.lowest(ls, len)
    float hiK = ta.highest(hs, len)
    var int   tr  = 0
    var float lPH = na
    var float lPL = na
    var float xH  = na
    var float xL  = na
    var float pHi = na
    var float pLo = na
    var float oLo = na
    var float oHi = na
    // origin of the current move
    if not na(pH)
        oLo := loK
    else if na(oLo) or ls < oLo
        oLo := ls
    if not na(pL)
        oHi := hiK
    else if na(oHi) or hs > oHi
        oHi := hs
    if not na(pH)
        lPH := pH
        if na(xH) or pH > xH
            xH := pH
    if not na(pL)
        lPL := pL
        if na(xL) or pL < xL
            xL := pL
    int e = 0
    if tr == 1
        if not na(pLo) and close < pLo
            e := -1
        else if not na(xH) and close > xH
            e := 1
    else if tr == -1
        if not na(pHi) and close > pHi
            e := 1
        else if not na(xL) and close < xL
            e := -1
    else
        if not na(xH) and close > xH
            e := 1
        else if not na(xL) and close < xL
            e := -1
    if e > 0
        tr  := 1
        pLo := na(oLo) ? lPL : oLo
        xH  := na
        xL  := na
    if e < 0
        tr  := -1
        pHi := na(oHi) ? lPH : oHi
        xH  := na
        xL  := na
    tr
 
f_trendInt(int len) =>
    float hs = lineSw ? close : math.max(open, close)
    float ls = lineSw ? close : math.min(open, close)
    float pH = ta.pivothigh(hs, len, len)
    float pL = ta.pivotlow(ls, len, len)
    var int   tr  = 0
    var float lPH = na
    var float lPL = na
    if not na(pH)
        lPH := pH
    if not na(pL)
        lPL := pL
    if not na(lPH) and close > lPH
        tr  := 1
        lPH := na
    else if not na(lPL) and close < lPL
        tr  := -1
        lPL := na
    tr
 
// Bias of each timeframe from its last CLOSED candle.
// Chart at or below that timeframe: the previous candle of that timeframe (lookahead on).
// Chart above it (for example 1H bias on a Daily chart): the last finished candle of
// that timeframe inside the current chart candle, so the value matches lower charts.
bool aboveD  = timeframe.in_seconds() > 86400
bool above4H = timeframe.in_seconds() > 14400
bool above1H = timeframe.in_seconds() > 3600
int dB_on  = nz(request.security(syminfo.tickerid, "D",   f_trendInt(1)[1], lookahead = barmerge.lookahead_on))
int dB_lo  = nz(request.security(syminfo.tickerid, "D",   f_trendInt(1)[1]))
int h4B_on = nz(request.security(syminfo.tickerid, "240", f_trendInt(1)[1], lookahead = barmerge.lookahead_on))
int h4B_lo = nz(request.security(syminfo.tickerid, "240", f_trendInt(1)[1]))
int h1B_on = nz(request.security(syminfo.tickerid, "60",  f_trendMajor(swLen)[1], lookahead = barmerge.lookahead_on))
int h1B_lo = nz(request.security(syminfo.tickerid, "60",  f_trendMajor(swLen)[1]))
int dB  = aboveD  ? dB_lo  : dB_on
int h4B = above4H ? h4B_lo : h4B_on
int h1B = above1H ? h1B_lo : h1B_on
int tradeB = dB != 0 and dB == h4B ? dB : h1B
 
biasTxt(int b) => b == 1 ? "BUY" : b == -1 ? "SELL" : "—"
biasClr(int b) => b == 1 ? buyCol : b == -1 ? sellCol : biasCol
 
// time left until the candle of that timeframe closes = next possible bias update
f_left(string tf) =>
    // chart at or below tf: that candle's own close time. Chart above tf: step back from
    // the chart candle's close in tf-sized steps (1H and 4H candles end on the daily close)
    int tfMs = timeframe.in_seconds(tf) * 1000
    int tc   = timeframe.in_seconds() <= timeframe.in_seconds(tf) ? time_close(tf) : time_close - int(math.floor((time_close - timenow) / tfMs)) * tfMs
    int ms   = math.max(tc - timenow, 0)
    int h  = int(ms / 3600000)
    int m  = int((ms % 3600000) / 60000)
    int sc = int((ms % 60000) / 1000)
    h > 0 ? str.tostring(h) + "h " + str.tostring(m, "00") + "m" : str.tostring(m, "00") + ":" + str.tostring(sc, "00")
 
f_row(table t, int r, string name, int b, string left) =>
    table.cell(t, 0, r, name, text_color = biasCol, text_halign = text.align_left, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(t, 1, r, biasTxt(b), text_color = biasClr(b), text_halign = text.align_center, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(t, 2, r, left, text_color = biasCol, text_halign = text.align_right, text_size = boxSz, text_font_family = font.family_monospace)
 
string tbPos = biasPos == "Top right" ? position.top_right : biasPos == "Top left" ? position.top_left : biasPos == "Bottom right" ? position.bottom_right : position.bottom_left
var table tb = table.new(tbPos, 3, 8, bgcolor = chart.bg_color, frame_color = color.new(biasCol, 40), frame_width = 1, border_color = color.new(biasCol, 85), border_width = 1)
if showBias and barstate.islast
    string l60 = f_left("60")
    // title
    table.cell(tb, 0, 0, "BIAS", text_color = biasCol, text_halign = text.align_left, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 1, 0, "", text_size = boxSz)
    table.cell(tb, 2, 0, syminfo.ticker, text_color = color.new(biasCol, 30), text_halign = text.align_right, text_size = boxSz, text_font_family = font.family_monospace)
    // column heads
    table.cell(tb, 0, 1, "TF", text_color = color.new(biasCol, 30), text_halign = text.align_left, text_size = size.tiny, text_font_family = font.family_monospace)
    table.cell(tb, 1, 1, "BIAS", text_color = color.new(biasCol, 30), text_halign = text.align_center, text_size = size.tiny, text_font_family = font.family_monospace)
    table.cell(tb, 2, 1, "UPDATES IN", text_color = color.new(biasCol, 30), text_halign = text.align_right, text_size = size.tiny, text_font_family = font.family_monospace)
    f_row(tb, 2, "Daily", dB, f_left("D"))
    f_row(tb, 3, "4H", h4B, f_left("240"))
    f_row(tb, 4, "1H", h1B, l60)
    // bias to trade
    table.cell(tb, 0, 5, "TRADE", text_color = color.white, bgcolor = biasClr(tradeB), text_halign = text.align_left, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 1, 5, biasTxt(tradeB), text_color = color.white, bgcolor = biasClr(tradeB), text_halign = text.align_center, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 2, 5, l60, text_color = color.white, bgcolor = biasClr(tradeB), text_halign = text.align_right, text_size = boxSz, text_font_family = font.family_monospace)
 
// ─────────────────────────── Alerts ───────────────────────────
// One TradingView alert set to "Any alert() function call" covers all of these.
// The alert fires on the first candle inside (open) or after (close) each window, so
// use a chart of 15 minutes or lower for exact times (the Asia close is at :15).
string sLdnKZ = isAuto ? "0200-0300" : isSum ? "0600-0700" : "0700-0800"
string sLdnTT = isAuto ? "0200-0500" : isSum ? "0600-0900" : "0700-1000"
string sNyTT  = isAuto ? "0800-1200" : isSum ? "1200-1600" : "1300-1700"
 
f_edge(string s) =>
    bool w = inS(s)
    [w and not w[1], not w and w[1]]
 
[asO, asC] = f_edge(sAsia)
[l1O, l1C] = f_edge(sLiq1)
[kzO, kzC] = f_edge(sLdnKZ)
[ltO, ltC] = f_edge(sLdnTT)
[l2O, l2C] = f_edge(sLiq2)
[nyO, nyC] = f_edge(sNyTT)
 
f_add(string m, bool c, string t) =>
    c ? (m == "" ? t : m + " · " + t) : m
 
string msg = ""
msg := f_add(msg, alAsia and asO, "Asia session open")
msg := f_add(msg, alAsia and asC, "Asia session close")
msg := f_add(msg, alLiq and l1O, "Frankfurt liquidity candle open")
msg := f_add(msg, alLiq and l1C, "Frankfurt liquidity candle close")
msg := f_add(msg, alLdn and kzO, "London killzone open")
msg := f_add(msg, alLdn and ltO, "London trading time open")
msg := f_add(msg, alLdn and kzC, "London killzone close, London session open")
msg := f_add(msg, alLdn and ltC, "London trading time close")
msg := f_add(msg, alLiq and l2O, "New York liquidity candle open (no trades)")
msg := f_add(msg, alLiq and l2C, "New York liquidity candle close")
msg := f_add(msg, alNy and nyO, "New York session and trading time open")
msg := f_add(msg, alNy and nyC, "New York trading time close")
 
if timeframe.isintraday and msg != ""
    alert(syminfo.ticker + ": " + msg, alert.freq_once_per_bar)
 
// ─────────────────────────── Early warnings ───────────────────────────
// Checked on every live price update, so they work on any chart timeframe.
// Event times are New York time (minutes after midnight); IST shown in the message.
int tzOff = isAuto ? 0 : isSum ? 240 : 300
var array<int> warned = array.new<int>()
 
f_evT(int nyMin) =>
    int m = (nyMin + tzOff) % 1440
    int t = timestamp(tz, year(timenow, tz), month(timenow, tz), dayofmonth(timenow, tz), int(m / 60), m % 60)
    t < timenow ? t + 86400000 : t
 
f_pre(string msgIn, bool on, int nyMin, string name) =>
    string r = msgIn
    if on and alPre and barstate.isrealtime
        int t = f_evT(nyMin)
        if timenow >= t - preMin * 60000 and not warned.includes(t)
            warned.push(t)
            if warned.size() > 50
                warned.shift()
            string txt = name + " at " + str.format_time(t, "h:mm a", "Asia/Kolkata") + " IST"
            r := r == "" ? txt : r + " · " + txt
    r
 
string pre = ""
pre := f_pre(pre, alAsia, 1020, "Asia session opens")
pre := f_pre(pre, alAsia, 15,   "Asia session closes")
pre := f_pre(pre, alLiq,  60,   "Frankfurt liquidity candle opens")
pre := f_pre(pre, alLdn,  120,  "London killzone and trading time open")
pre := f_pre(pre, alLdn,  180,  "London session opens")
pre := f_pre(pre, alLdn,  300,  "London trading time closes")
pre := f_pre(pre, alLiq,  420,  "New York liquidity candle opens")
pre := f_pre(pre, alNy,   480,  "New York session and trading time open")
pre := f_pre(pre, alNy,   720,  "New York trading time closes")
 
if pre != ""
    alert(syminfo.ticker + ": in " + str.tostring(preMin) + " min: " + pre, alert.freq_all)
 
// ─────────────────────────── Session status (now / next) ───────────────────────────
// Windows in New York time, minutes after midnight:
//   Asia 17:00 – 00:15 · Frankfurt candle 01:00 – 02:00 · London killzone 02:00 – 03:00
//   London session 03:00 – 05:00 · New York liquidity candle 07:00 – 08:00
//   New York session 08:00 – 12:00. Trades only in the London and New York windows.
f_m(int nyMin) =>
    (nyMin + tzOff) % 1440
 
int nowMin = hour(timenow, tz) * 60 + minute(timenow, tz)
int nowSec = second(timenow, tz)
 
f_in(int a, int b) =>
    int st = f_m(a)
    int en = f_m(b)
    st < en ? nowMin >= st and nowMin < en : nowMin >= st or nowMin < en
 
// milliseconds until a New York clock time (next occurrence)
f_until(int nyMin) =>
    int d = (f_m(nyMin) - nowMin + 1440) % 1440
    (d == 0 ? 1440 : d) * 60000 - nowSec * 1000
 
f_fmt(int ms) =>
    int h = int(ms / 3600000)
    int m = int((ms % 3600000) / 60000)
    int sc = int((ms % 60000) / 1000)
    h > 0 ? str.tostring(h) + "h " + str.tostring(m, "00") + "m" : str.tostring(m, "00") + ":" + str.tostring(sc, "00")
 
// market closed: Friday 17:00 to Sunday 17:00 New York time
int  nyDow = dayofweek(timenow, "America/New_York")
int  nyNow = hour(timenow, "America/New_York") * 60 + minute(timenow, "America/New_York")
bool wkClosed = nyDow == dayofweek.saturday or (nyDow == dayofweek.sunday and nyNow < 1020) or (nyDow == dayofweek.friday and nyNow >= 1020)
 
string stTxt = "NO TRADE TIME"
bool   stTrd = false
int    stEnd = na
if wkClosed
    stTxt := "MARKET CLOSED"
else if f_in(120, 180)
    stTxt := "LONDON KILLZONE"
    stTrd := true
    stEnd := 180
else if f_in(180, 300)
    stTxt := "LONDON SESSION"
    stTrd := true
    stEnd := 300
else if f_in(480, 720)
    stTxt := "NEW YORK SESSION"
    stTrd := true
    stEnd := 720
else if f_in(60, 120)
    stTxt := "FRANKFURT CANDLE · NO TRADE"
    stEnd := 120
else if f_in(420, 480)
    stTxt := "NY LIQ. CANDLE · NO TRADE"
    stEnd := 480
else if f_in(1020, 15)
    stTxt := "ASIA SESSION · NO TRADE"
    stEnd := 15
 
// next window to start
string nxTxt = ""
int    nxMs  = na
f_next(int nyStart, string name) =>
    int ms = f_until(nyStart)
    [ms, name]
[n1, t1] = f_next(1020, "Asia session")
[n2, t2] = f_next(60,   "Frankfurt candle")
[n3, t3] = f_next(120,  "London killzone")
[n4, t4] = f_next(180,  "London session")
[n5, t5] = f_next(420,  "NY liq. candle")
[n6, t6] = f_next(480,  "New York session")
nxMs  := n1
nxTxt := t1
if n2 < nxMs
    nxMs  := n2
    nxTxt := t2
if n3 < nxMs
    nxMs  := n3
    nxTxt := t3
if n4 < nxMs
    nxMs  := n4
    nxTxt := t4
if n5 < nxMs
    nxMs  := n5
    nxTxt := t5
if n6 < nxMs
    nxMs  := n6
    nxTxt := t6
 
if showBias and showSt and barstate.islast
    color stCol = stTrd ? buyCol : sellCol
    color stBg  = color.new(stCol, 85)
    table.cell(tb, 0, 6, "NOW", text_color = stCol, bgcolor = stBg, text_halign = text.align_left, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 1, 6, stTxt, text_color = stCol, bgcolor = stBg, text_halign = text.align_center, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 2, 6, na(stEnd) ? "" : "ends " + f_fmt(f_until(stEnd)), text_color = stCol, bgcolor = stBg, text_halign = text.align_right, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 0, 7, "NEXT", text_color = biasCol, text_halign = text.align_left, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 1, 7, nxTxt, text_color = biasCol, text_halign = text.align_center, text_size = boxSz, text_font_family = font.family_monospace)
    table.cell(tb, 2, 7, "in " + f_fmt(nxMs), text_color = biasCol, text_halign = text.align_right, text_size = boxSz, text_font_family = font.family_monospace)

← 返回列表