BISI/SIBI MTF + Quarterly Theory True Open

elmori · study · 463 行 · 点赞 21 · TradingView 原页

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

Pine Script

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mor2811
 
//@version=6
indicator("BISI/SIBI MTF + Quarterly Theory True Open", shorttitle="BISI+QT", overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count=500)
 
// ========================================================================= //
// ========================= INPUTS & SETTINGS ============================= //
// ========================================================================= //
 
grp_tf = "Timeframes & Limits"
show_1m   = input.bool(true, "Show 1m FVG", group=grp_tf)
show_5m   = input.bool(true, "Show 5m FVG", group=grp_tf)
show_15m  = input.bool(true, "Show 15m FVG", group=grp_tf)
show_1h   = input.bool(true, "Show 1H FVG", group=grp_tf)
show_4h   = input.bool(true, "Show 4H FVG", group=grp_tf)
max_fvgs  = input.int(2, "Max Active FVGs per TF", minval=1, maxval=4, group=grp_tf)
min_ticks = input.int(5, "Minimum FVG Size (Ticks)", minval=1, group=grp_tf)
absorb_vi = input.bool(true, "Absorb Volume Imbalances into Gaps", group=grp_tf, tooltip="A volume imbalance is a two-candle BODY gap that a wick still trades through. When one sits on either side of the gap candle, the zone widens to that body edge, so one zone carries the whole region.")
no_overlap = input.bool(true, "No Overlap Across Timeframes", group=grp_tf, tooltip="A gap that shares any price with a gap drawn from a higher timeframe is not drawn, so the 4H gap wins over the 1H and the 1H over the 15m.")
show_sb   = input.bool(true, "Detect Suspension Blocks", group=grp_tf, tooltip="Three same-direction candles, each opening beyond the previous close, carry a volume imbalance on both sides of the middle candle. That leg is drawn as one zone from the first close to the last open, labelled SB.")
 
grp_style = "Visuals & Styling"
color_bisi = input.color(color.rgb(0, 149, 255, 65), "BISI Color (Bullish)", group=grp_style)
color_sibi = input.color(color.rgb(209, 2, 2, 65), "SIBI Color (Bearish)", group=grp_style)
show_ce    = input.bool(true, "Show 50% (CE) Line", group=grp_style)
show_25_75 = input.bool(true, "Show 25% & 75% Lines", group=grp_style)
line_col   = input.color(color.rgb(0, 0, 0, 50), "Internal Line Color", group=grp_style)
 
grp_ext = "Extension & Mitigation Logic"
ext_mode = input.string("Extend to Current Bar", "Extension Mode", options=["Extend Right", "Extend to Current Bar", "No Extension (Fixed)"], group=grp_ext)
mit_pct  = input.float(65.0, "Mitigation % (Threshold to Remove)", group=grp_ext) / 100.0
 
// ========================================================================= //
// ========================== TYPES & ARRAYS =============================== //
// ========================================================================= //
 
type FVG
    float  top
    float  bottom
    int    start_time
    int    end_time
    bool   is_bisi
    string tf_str
    box    bg = na
    line   ce = na
    line   l25 = na
    line   l75 = na
    label  lbl = na
    bool   is_sb = false
 
var fvgs_1m  = array.new<FVG>()
var fvgs_5m  = array.new<FVG>()
var fvgs_15m = array.new<FVG>()
var fvgs_1h  = array.new<FVG>()
var fvgs_4h  = array.new<FVG>()
 
// ========================================================================= //
// =================== CHART TIMEFRAME & AGGREGATION ======================= //
// ========================================================================= //
 
int chart_mins = timeframe.in_seconds() / 60
int n1   = chart_mins == 1 ? 1 : 0
int n5   = chart_mins > 0 and chart_mins <= 5   and 5   % chart_mins == 0 ? 5   / chart_mins : 0
int n15  = chart_mins > 0 and chart_mins <= 15  and 15  % chart_mins == 0 ? 15  / chart_mins : 0
int n60  = chart_mins > 0 and chart_mins <= 60  and 60  % chart_mins == 0 ? 60  / chart_mins : 0
int n240 = chart_mins > 0 and chart_mins <= 240 and 240 % chart_mins == 0 ? 240 / chart_mins : 0
 
bool boundary_1m   = n1   > 0 ? timeframe.change("1")   : false
bool boundary_5m   = n5   > 0 ? timeframe.change("5")   : false
bool boundary_15m  = n15  > 0 ? timeframe.change("15")  : false
bool boundary_1h   = n60  > 0 ? timeframe.change("60")  : false
bool boundary_4h   = n240 > 0 ? timeframe.change("240") : false
 
agg_high(int offset, int n) =>
    float h = high[offset]
    if n > 1
        for i = 1 to n - 1
            h := math.max(h, high[offset + i])
    h
 
agg_low(int offset, int n) =>
    float l = low[offset]
    if n > 1
        for i = 1 to n - 1
            l := math.min(l, low[offset + i])
    l
 
// ========================================================================= //
// ========================== CORE FUNCTIONS =============================== //
// ========================================================================= //
 
has_overlap(array<FVG> arr, float new_top, float new_bottom) =>
    bool found = false
    if array.size(arr) > 0
        for i = 0 to array.size(arr) - 1
            f = array.get(arr, i)
            if new_top > f.bottom and f.top > new_bottom
                found := true
    found
 
//@function Adds a gap or suspension block from three HTF candles, A oldest, C newest.
//          A suspension block (three same-direction candles, each opening beyond the previous
//          close) is one zone from A's close to C's open. A wick gap widens to the body edge on
//          either seam that carries a volume imbalance. A seam across a session break is skipped.
check_and_add_fvg(array<FVG> arr, float hA, float lA, float oA, float cA, int tA, float hB, float lB, float oB, float cB, int tB, float hC, float lC, float oC, float cC, int tC, int tf_ms, string tf_str, bool show_tf) =>
    if show_tf and not na(hC) and not na(lA) and not na(hB) and not na(oA) and not na(oB) and not na(oC)
        float minSz  = min_ticks * syminfo.mintick
        bool  seamAB = not na(tA) and not na(tB) and (tB - tA) <= tf_ms * 1.5
        bool  seamBC = not na(tB) and not na(tC) and (tC - tB) <= tf_ms * 1.5
        bool  sbUp   = show_sb and seamAB and seamBC and cA > oA and cB > oB and cC > oC and oB > cA and oC > cB and (oC - cA) >= minSz
        bool  sbDn   = show_sb and seamAB and seamBC and cA < oA and cB < oB and cC < oC and oB < cA and oC < cB and (cA - oC) >= minSz
        bool  gapUp  = lC > hA and (lC - hA) >= minSz
        bool  gapDn  = hC < lA and (lA - hC) >= minSz
        if sbUp or gapUp
            float t = sbUp ? oC : lC
            float b = sbUp ? cA : hA
            if not sbUp and absorb_vi
                if seamAB and math.min(oB, cB) > math.max(oA, cA)
                    b := math.min(b, math.max(oA, cA))
                if seamBC and math.min(oC, cC) > math.max(oB, cB) and lC <= hB
                    t := math.max(t, math.min(oC, cC))
            if not has_overlap(arr, t, b)
                array.push(arr, FVG.new(top = t, bottom = b, start_time = sbUp ? tA : tB, end_time = tC, is_bisi = true, tf_str = tf_str, is_sb = sbUp))
        else if sbDn or gapDn
            float t = sbDn ? cA : lA
            float b = sbDn ? oC : hC
            if not sbDn and absorb_vi
                if seamAB and math.max(oB, cB) < math.min(oA, cA)
                    t := math.max(t, math.min(oA, cA))
                if seamBC and math.max(oC, cC) < math.min(oB, cB) and hC >= lB
                    b := math.min(b, math.max(oC, cC))
            if not has_overlap(arr, t, b)
                array.push(arr, FVG.new(top = t, bottom = b, start_time = sbDn ? tA : tB, end_time = tC, is_bisi = false, tf_str = tf_str, is_sb = sbDn))
    true
 
//@function True when a zone shares any price with a zone already drawn from a higher timeframe.
shown_overlap(array<FVG> arr, float top, float bot) =>
    bool found = false
    if array.size(arr) > 0
        for i = 0 to array.size(arr) - 1
            f = array.get(arr, i)
            if not na(f.bg) and top > f.bottom and f.top > bot
                found := true
    found
 
//@function Retires mitigated zones and draws the newest ones. A zone that overlaps a zone drawn
//          from either higher timeframe is not drawn, so the higher timeframe gap is the one shown.
process_fvgs(array<FVG> arr, int current_time, float current_high, float current_low, array<FVG> senior1, array<FVG> senior2, array<FVG> senior3, array<FVG> senior4) =>
    int total = array.size(arr)
 
    if total > 0
        for i = total - 1 to 0
            f = array.get(arr, i)
            float range_val = f.top - f.bottom
            bool is_mitigated = false
 
            if f.is_bisi
                float threshold = f.top - (range_val * mit_pct)
                if current_low <= threshold
                    is_mitigated := true
            else
                float threshold = f.bottom + (range_val * mit_pct)
                if current_high >= threshold
                    is_mitigated := true
 
            if is_mitigated
                if not na(f.bg)
                    box.delete(f.bg)
                    line.delete(f.ce)
                    line.delete(f.l25)
                    line.delete(f.l75)
                    label.delete(f.lbl)
                array.remove(arr, i)
 
    total := array.size(arr)
    if total > 0
        for i = 0 to total - 1
            f = array.get(arr, i)
            bool should_show = (total - i) <= max_fvgs and not (no_overlap and (shown_overlap(senior1, f.top, f.bottom) or shown_overlap(senior2, f.top, f.bottom) or shown_overlap(senior3, f.top, f.bottom) or shown_overlap(senior4, f.top, f.bottom)))
 
            if should_show
                float range_val = f.top - f.bottom
                float ce_val  = f.top - (range_val * 0.50)
                float q1_val  = f.top - (range_val * 0.25)
                float q3_val  = f.top - (range_val * 0.75)
                int   draw_right = ext_mode == "No Extension (Fixed)" ? f.end_time : current_time
 
                // Stagger label Y per TF so overlapping boxes don't stack labels
                // Labels are staggered vertically by timeframe to reduce collisions.
                float lbl_y = f.tf_str == "1m" ? f.top : f.tf_str == "5m" ? q1_val : f.tf_str == "15m" ? ce_val : f.tf_str == "1H" ? q3_val : f.bottom
 
                if na(f.bg)
                    color bg_col = f.is_bisi ? color_bisi : color_sibi
                    f.bg := box.new(f.start_time, f.top, draw_right, f.bottom, xloc=xloc.bar_time, border_color=color.new(bg_col, 50), border_width=1, bgcolor=bg_col)
 
                    if show_ce
                        f.ce := line.new(f.start_time, ce_val, draw_right, ce_val, xloc=xloc.bar_time, color=line_col, style=line.style_solid)
                    if show_25_75
                        // Solid lines for the quarter levels
                        f.l25 := line.new(f.start_time, q1_val, draw_right, q1_val, xloc=xloc.bar_time, color=line_col, style=line.style_solid)
                        f.l75 := line.new(f.start_time, q3_val, draw_right, q3_val, xloc=xloc.bar_time, color=line_col, style=line.style_solid)
 
                    string lbl_text = f.tf_str + (f.is_sb ? (f.is_bisi ? " SB+" : " SB-") : f.is_bisi ? " BISI" : " SIBI")
                    f.lbl := label.new(f.start_time, lbl_y, text=lbl_text, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_right, color=color.new(color.white, 100), textcolor=#000000, size=size.small)
 
                    if ext_mode == "Extend Right"
                        box.set_extend(f.bg, extend.right)
                        if show_ce
                            line.set_extend(f.ce, extend.right)
                        if show_25_75
                            line.set_extend(f.l25, extend.right)
                            line.set_extend(f.l75, extend.right)
 
                else if ext_mode == "Extend to Current Bar"
                    box.set_right(f.bg, current_time)
                    if show_ce
                        line.set_x2(f.ce, current_time)
                    if show_25_75
                        line.set_x2(f.l25, current_time)
                        line.set_x2(f.l75, current_time)
 
            else
                if not na(f.bg)
                    box.delete(f.bg)
                    f.bg := na
                    if show_ce
                        line.delete(f.ce)
                        f.ce := na
                    if show_25_75
                        line.delete(f.l25)
                        f.l25 := na
                        line.delete(f.l75)
                        f.l75 := na
                    label.delete(f.lbl)
                    f.lbl := na
    true
 
// ========================================================================= //
// ======================== FVG DETECTION ================================== //
// ========================================================================= //
 
// ── 4H security data (top-level scope required) ───────────────────────────
// Aggregation breaks for 4H because session gaps accumulate across ~12h of
// lookback and throw off bar counting. request.security() aligns to actual
// 4H bar boundaries. C=[1], B=[2] (displacement), A=[3].
[h4_c_h, h4_c_l, h4_c_o, h4_c_c, h4_t_c, h4_b_h, h4_b_l, h4_b_o, h4_b_c, h4_t_b, h4_a_h, h4_a_l, h4_a_o, h4_a_c, h4_t_a] = request.security(syminfo.tickerid, "240", [high[1], low[1], open[1], close[1], time[1], high[2], low[2], open[2], close[2], time[2], high[3], low[3], open[3], close[3], time[3]], lookahead=barmerge.lookahead_on)
 
// ── 1m ──
if boundary_1m and show_1m and n1 > 0
    check_and_add_fvg(fvgs_1m, high[3], low[3], open[3], close[3], time[3], high[2], low[2], open[2], close[2], time[2], high[1], low[1], open[1], close[1], time[1], 60000, "1m", true)
 
// ── 5m ──
if boundary_5m and show_5m and n5 > 0
    check_and_add_fvg(fvgs_5m, agg_high(1 + 2 * n5, n5), agg_low(1 + 2 * n5, n5), open[3 * n5], close[1 + 2 * n5], time[3 * n5], agg_high(1 + n5, n5), agg_low(1 + n5, n5), open[2 * n5], close[1 + n5], time[2 * n5], agg_high(1, n5), agg_low(1, n5), open[n5], close[1], time[n5], 300000, "5m", true)
 
// ── 15m ──
if boundary_15m and show_15m and n15 > 0
    check_and_add_fvg(fvgs_15m, agg_high(1 + 2 * n15, n15), agg_low(1 + 2 * n15, n15), open[3 * n15], close[1 + 2 * n15], time[3 * n15], agg_high(1 + n15, n15), agg_low(1 + n15, n15), open[2 * n15], close[1 + n15], time[2 * n15], agg_high(1, n15), agg_low(1, n15), open[n15], close[1], time[n15], 900000, "15m", true)
 
// ── 1H ──
if boundary_1h and show_1h and n60 > 0
    check_and_add_fvg(fvgs_1h, agg_high(1 + 2 * n60, n60), agg_low(1 + 2 * n60, n60), open[3 * n60], close[1 + 2 * n60], time[3 * n60], agg_high(1 + n60, n60), agg_low(1 + n60, n60), open[2 * n60], close[1 + n60], time[2 * n60], agg_high(1, n60), agg_low(1, n60), open[n60], close[1], time[n60], 3600000, "1H", true)
 
// ── 4H ──
if timeframe.change("240") and show_4h
    check_and_add_fvg(fvgs_4h, h4_a_h, h4_a_l, h4_a_o, h4_a_c, h4_t_a, h4_b_h, h4_b_l, h4_b_o, h4_b_c, h4_t_b, h4_c_h, h4_c_l, h4_c_o, h4_c_c, h4_t_c, 14400000, "4H", true)
 
// ── Mitigation & visuals ──
process_fvgs(fvgs_4h,  time, high, low, array.new<FVG>(), array.new<FVG>(), array.new<FVG>(), array.new<FVG>())
process_fvgs(fvgs_1h,  time, high, low, fvgs_4h, array.new<FVG>(), array.new<FVG>(), array.new<FVG>())
process_fvgs(fvgs_15m, time, high, low, fvgs_4h, fvgs_1h, array.new<FVG>(), array.new<FVG>())
process_fvgs(fvgs_5m,  time, high, low, fvgs_4h, fvgs_1h, fvgs_15m, array.new<FVG>())
process_fvgs(fvgs_1m,  time, high, low, fvgs_4h, fvgs_1h, fvgs_15m, fvgs_5m)
 
// ============================================================================
// QUARTERLY THEORY — PERIOD TRUE OPEN
// Объединённый блок. Логика BISI/SIBI выше не изменена.
// ============================================================================
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 1. НАСТРОЙКИ TRUE OPEN
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
string TZ = input.string("America/New_York", "Часовой пояс циклов")
 
g1 = "True Open — Старшие циклы"
showYear = input.bool(true, "Yearly", group=g1)
colYear = input.color(color.fuchsia, "Цвет Yearly", group=g1)
showMonth = input.bool(true, "Monthly", group=g1)
colMonth = input.color(color.blue, "Цвет Monthly", group=g1)
showWeek = input.bool(true, "Weekly", group=g1)
colWeek = input.color(color.orange, "Цвет Weekly", group=g1)
 
g2 = "True Open — Внутридневные циклы"
showDay = input.bool(true, "Daily", group=g2)
colDay = input.color(color.lime, "Цвет Daily", group=g2)
show6H = input.bool(true, "6H", group=g2)
col6H = input.color(color.aqua, "Цвет 6H", group=g2)
show90 = input.bool(true, "90M", group=g2)
col90 = input.color(color.yellow, "Цвет 90M", group=g2)
 
g3 = "True Open — Отображение"
showLabels = input.bool(true, "Подписи справа над линиями", group=g3)
lineWidth = input.int(1, "Толщина линий", minval=1, maxval=4, group=g3)
styleInput = input.string("Сплошная", "Стиль линий", options=["Сплошная", "Пунктирная", "Точечная"], group=g3)
labelSizeInput = input.string("Очень маленький", "Размер подписей", options=["Очень маленький", "Маленький", "Обычный"], group=g3)
historyDays = input.int(7, "История внутридневных циклов, дней", minval=1, maxval=30, group=g3)
maxLevels = input.int(300, "Максимум уровней True Open", minval=50, maxval=450, group=g3)
 
toLineStyle = styleInput == "Пунктирная" ? line.style_dashed : styleInput == "Точечная" ? line.style_dotted : line.style_solid
toLabelSize = labelSizeInput == "Обычный" ? size.normal : labelSizeInput == "Маленький" ? size.small : size.tiny
 
// Идентификаторы типов циклов
int YEARLY = 1
int MONTHLY = 2
int WEEKLY = 3
int DAILY = 4
int SIX_HOUR = 5
int NINETY_MIN = 6
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 2. ХРАНЕНИЕ УРОВНЕЙ TRUE OPEN
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
var array<line> toLines = array.new_line()
var array<label> toLabels = array.new_label()
var array<float> toPrices = array.new_float()
var array<int> toCycleTypes = array.new_int()
var array<bool> toActive = array.new_bool()
 
// Проверка, попадает ли время события внутрь свечи.
to_event(int ts) =>
    not na(time_close) and time <= ts and time_close > ts
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 3. СОЗДАНИЕ УРОВНЯ TRUE OPEN
// Предыдущий уровень того же цикла заканчивается
// в момент открытия нового периода.
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
to_add(int ts, float price, string txt, color clr, int cycle) =>
    if array.size(toLines) > 0
        for i = 0 to array.size(toLines) - 1
            if array.get(toCycleTypes, i) == cycle and array.get(toActive, i)
                line oldLine = array.get(toLines, i)
                label oldLabel = array.get(toLabels, i)
                line.set_x2(oldLine, ts)
                line.set_extend(oldLine, extend.none)
                array.set(toActive, i, false)
                if not na(oldLabel)
                    label.set_x(oldLabel, ts)
 
    line ln = line.new(
         x1=ts, y1=price, x2=time_close, y2=price,
         xloc=xloc.bar_time, extend=extend.right,
         color=clr, width=lineWidth, style=toLineStyle)
 
    label lb = na
    if showLabels
        lb := label.new(
             x=time_close, y=price, text=txt,
             xloc=xloc.bar_time, style=label.style_label_down,
             color=color.new(clr, 100), textcolor=clr, size=toLabelSize)
 
    array.push(toLines, ln)
    array.push(toLabels, lb)
    array.push(toPrices, price)
    array.push(toCycleTypes, cycle)
    array.push(toActive, true)
 
    if array.size(toLines) > maxLevels
        line oldLine = array.shift(toLines)
        label oldLabel = array.shift(toLabels)
        array.shift(toPrices)
        array.shift(toCycleTypes)
        array.shift(toActive)
        line.delete(oldLine)
        if not na(oldLabel)
            label.delete(oldLabel)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 4. ПРОДЛЕНИЕ АКТИВНЫХ TRUE OPEN ЛИНИЙ
// Касание цены не завершает уровень.
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
if array.size(toLines) > 0
    for i = 0 to array.size(toLines) - 1
        if array.get(toActive, i)
            line ln = array.get(toLines, i)
            label lb = array.get(toLabels, i)
            float price = array.get(toPrices, i)
            line.set_x2(ln, time_close)
            if not na(lb)
                int labelTime = time_close + timeframe.in_seconds() * 1000
                label.set_x(lb, labelTime)
                label.set_y(lb, price)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 5. ВРЕМЕННЫЕ ДАННЫЕ
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
int yy = year(time, TZ)
int mm = month(time, TZ)
int dd = dayofmonth(time, TZ)
int dow = dayofweek(time, TZ)
 
bool inHistory = time >= timenow - historyDays * 86400000
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 6. YEARLY — 1 апреля, 00:00 ET
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
int yearTS = timestamp(TZ, yy, 4, 1, 0, 0)
if showYear and to_event(yearTS)
    to_add(yearTS, open, "YEARLY", colYear, YEARLY)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 7. MONTHLY — 8-е число, 00:00 ET
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
int monthTS = timestamp(TZ, yy, mm, 8, 0, 0)
if showMonth and to_event(monthTS)
    to_add(monthTS, open, "MONTHLY", colMonth, MONTHLY)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 8. WEEKLY — понедельник, 18:00 ET
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
int weekTS = timestamp(TZ, yy, mm, dd, 18, 0)
if showWeek and dow == dayofweek.monday and to_event(weekTS)
    to_add(weekTS, open, "WEEKLY", colWeek, WEEKLY)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 9. DAILY — 00:00 ET
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
int dayTS = timestamp(TZ, yy, mm, dd, 0, 0)
if showDay and inHistory and to_event(dayTS)
    to_add(dayTS, open, "DAILY", colDay, DAILY)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 10. 6H — 01:30, 07:30, 13:30, 19:30 ET
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
if show6H and inHistory
    for h = 0 to 3
        int ts6 = timestamp(TZ, yy, mm, dd, h * 6 + 1, 30)
        if to_event(ts6)
            to_add(ts6, open, "6H", col6H, SIX_HOUR)
 
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 11. 90M — True Open через 22м30с от начала цикла,
// циклы отсчитываются от 18:00 ET.
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
if show90 and inHistory
    for offset = -1 to 0
        int anchor = timestamp(TZ, yy, mm, dd + offset, 18, 0)
        for k = 0 to 15
            int ts90 = anchor + 1350000 + k * 5400000
            if to_event(ts90)
                to_add(ts90, open, "90M", col90, NINETY_MIN)

← 返回列表