//@version=6 // ============================================================================= // TMU TIME CYCLE LEVELS // Liquidity H/L (sessions + prev day/week/month) + Opening Lines + Opening Gaps // Everything on NY time via "America/New_York" -> summer/winter time (DST) auto. // ----------------------------------------------------------------------------- // A) LIQUIDITY H/L // · Sessions (current trading day, reset 18:00) + Prev Week/Month (mitigation). // · Prev. Day: adjustable number of MOST RECENT highs/lows back in time. // By default only unmitigated; toggle to keep mitigated ones. // · Mitigation: line stops at the mitigation point; label is placed at that // END (high above, low below) so you can see it on long lines. // · Styling: unmitigated = 1 colour + solid, mitigated = 1 colour + dotted. // MERGE + TF-PRIORITY: all levels in 1 pool, grouped by price. // · Same price -> 1 line + merged label; other price -> separate lines. // · Within day/week/month family the HIGHEST TF wins (lower ones dropped). // Sessions + opens always merge in. A group with an opening line keeps // running and takes its style (an open does not mitigate). // B) OPENING LINES — 09:30 . W.O. (Sunday 18:00) . M.O. . C.O. (current 90M). // C) OPENING GAPS — NWOG (Fri-close -> Sun-open, whole week) + NDOG (18:00->18:00). // D) 90M BOXES — box only (their C2 levels are gone, see 2026-08-22). Red // (manipulation) windows always keep the red colour; the rest is hidden, // greyed out or drawn in the AMD rotation via "Non-red 90M windows". // E) ANCHOR CLUSTERS — soft red boxes around the star anchors 04:00 / 10:00 / // 12:00 NY (-40m .. +40m), with the two anchor-adjacent 13.3m cycles // (C1/C2) as sub-boxes; their H/L feed the normal level pool and get the // unmitigated/mitigated styling of group 2 automatically. // ----------------------------------------------------------------------------- // FIXES 2026-08-14 — levels/inputs unchanged, only wrong values corrected // 1 Prev. Day is now a CALENDAR day. The old `dow != sunday` guard blocked the // seal on the Sunday 18:00 bar, so Friday + Sunday evening became one level. // 2 C.O. ran on a SECOND 90M grid anchored at 01:00 that kept ticking overnight // (17:30 / 19:00 / 20:30 / 22:00 / 23:30 / 01:00). Now one raster, cyc90k, // shared with the boxes: 02:30-15:59, empty outside it. // 3 09:30 was captured on window OVERLAP, so on a 1H chart it drew the 09:00 // open. Now the bar-open itself is tested. // 4 WITHDRAWN. I claimed the box trim was a bug ("the last candle hangs // outside its own box"). It is not: with xloc.bar_time a timestamp sits on // the CENTRE of its candle, so the original edges were already centred on // the first and last candle of the cycle, with one candle of air before the // next box. Two attempted fixes made it worse and were both reverted. The // box code is back to its original form - see the note in f_cycleBox. // 5 "ALL red 3.33M" claimed to work on 1-min; 200 s boundaries cannot land on // 60 s bars. Every cycle level is now gated on the grid it actually needs. // 6 EQ lines were never deleted and ate the shared 500-line budget. Capped. // Timings are unchanged and were already right: 90M 02:30-15:59 in 9 cycles // closing on xx:29/xx:59, sessions 18:00-02:29 / 02:30-06:59 / 07:00-11:29 / // 11:30-15:59, LON02 04:00-05:29 . AM02 08:30-09:59 . PM02 13:00-14:29. // ----------------------------------------------------------------------------- // REVISION 2026-08-18 — one real bug (7), the rest is structure. No level // moves, no input is removed, one input is added (12, default = old behaviour). // 7 BUG. The C2 windows (LON02/AM02/PM02) were a SECOND hard-coded 90M raster // (240-329 / 510-599 / 780-869 min) sitting next to cyc90k -- exactly the // duplication fix 2 had just removed for C.O. -- AND they had no alignment // gate. On a 1H chart the 05:00 bar satisfies `mnts <= 329` but runs to // 05:59, so half an hour of London-3 data was folded into the LON02 high/ // low. Same at 09:00 for AM02 and 14:00 for PM02. The windows are now // derived from cyc90k (the red keys 3/6/9) and gated on ali30, like every // other cycle-based level. Consequence, deliberate and silent as elsewhere: // on a TF that is not a divisor of 30 min there are no C2 levels at all. // 8 STRUCTURE. The parallel-array pattern is gone. Eight arrays held together // by comma-chained pushes (the render pool), six for the prev-day history, // five for C2, four for the C2 accumulator and seven for the session state // were one forgotten push away from a silent index shift -- a class of bug // that never shows up in the compiler, only on the chart, and only if you // happen to look. All of it is now four user-defined types: Sess, Lvl, Acc // and PLvl. Same data, same order, same output; one object per level. // 9 The session-state arrays had a dead slot 4 (a leftover from when prev-day // lived in the same array). Week/month are now index 4/5 of a 6-slot array. // 10 key32 and key3all were the same 200-second arithmetic twice with a // different filter. Folded into f_key200(gate, redOnly). // 11 The "single source of truth" claim only held for the 90M raster; the // session/AM1/second-window boundaries were still magic numbers spread over // the file, with the header table as the only place they were written down. // Collected in one constants block, so the code IS the table. // 12 A mitigated liquidity level that merges with an opening line loses every // visual trace of being mitigated: the group keeps running in the open's // style, so "Prev. Day H + 09:30" reads as a live level while the Prev. Day // side is already taken out. That is by design (an open does not mitigate), // but it is worth being able to see. New toggle marks such a member "(m)". // Default OFF = identical to the old label. // REVISION 2026-08-18b — prev day / prev week lows could sit on candles from // the CURRENT trading period (highs too, but overnight sessions set the low // far more often, so you see it on lows first): // 13 The week sealed on weekofyear(). Whether that number flips on Sunday or // on Monday is a TradingView convention; with the Monday convention "prev // week" runs Mon 00:00 - Sun 23:59 NY and swallows the Sunday-evening // session of the NEW trading week -- the week-scale twin of fix 1. After a // Sunday gap-down the Prev. Week L then sat on a candle from THIS week. // wkid also misbehaved around New Year (week 1 vs 53 jump). The week now // seals on the trading-week event itself: the Sunday 18:00 open, the same // bar that captures W.O. Prev week = Sun 18:00 -> Fri 17:00 by // construction, no calendar convention involved. Edge case, accepted: if a // Sunday open is ever missing, that week seals on the next Sunday and // covers two weeks. // 14 Prev. Day definition is now an input. "Calendar" (00:00-23:59, default, // the original spec, unchanged behaviour) includes 18:00-23:59 -- which is // the ASIA OPEN OF THE NEXT TRADING DAY. On Tuesday the "Prev. Day L" can // therefore be Monday-evening's Asia low, i.e. the low of the CURRENT // trading day, merged into one line with "Asia L". Not a code bug, but on // the chart it reads like one. New option "Trading day (18:00-17:00)" // seals on the 18:00 open instead; in that mode the 6-hour Sunday-evening // stub day does not exist (Sun 18:00 opens MONDAY's trading day), so the // "skip Sunday evening" toggle only applies to Calendar mode. // 15 Not a bug, but it read like one: "Show prev. days = 3" means the 3 most // recent UNMITIGATED prev-days, so after a stretch where every recent low // got swept, the render walks back until it finds intact ones -- and a // "Prev. Day L" from 10 days ago shows up with a label that reads as // yesterday. Two additions: the prev-day label can carry the date of the // candle that made the level (default ON), and a max-age input caps how // far back the walk may go (0 = unlimited, the old behaviour). If you want // "always the last N days, swept ones included", that already exists: turn // on "also keep mitigated prev-days". // REVISION 2026-08-22 — v3, SLIM + ANCHOR CLUSTERS. Decided in consultation: // the chart was too busy and half the inputs served modules the other // indicators now cover. // REMOVED: 30M / 10M / 3.33M cycle boxes (incl. f_key200 and the ALL-red // toggles), AM1, red-focus toggles, and the C2 LEVELS (LON02/AM02/PM02). // Deliberate consequence of dropping C2: no more 08:30 / 13:00 levels -- the // anchor clusters below are the timing tool now. The 90M BOXES stay (box // only, original times), as do liquidity, opens, gaps and session boxes. // NEW: E) ANCHOR CLUSTERS -- per Leon's ladder screenshots, deliberately ONLY // the three anchors 04:00 / 10:00 / 12:00 NY (not 18:00, not the other star // anchors): three windows a day, calm chart, no overtrading. // · cluster box = anchor -40m .. +40m, i.e. 03:20-04:40, 09:20-10:40, // 11:20-12:40, soft red fill + dotted border, star label (12:00 = 4-star, // the others 3-star). // · inside it the two ANCHOR-ADJACENT 13.3m cycles: C1 = the last 13.3 // before the anchor, C2 = the first after it -- the CRT pair of the // anchor transition. CHOSEN RULE under Leon's standing mandate ("bij // twijfel mag Claude kiezen"): if his ladder file marks different 13.3s // as stars, edit the ancA/ancB window table -- one line, everything else // follows it. // · H/L of C1/C2 go into the normal level pool: merge, mitigation and the // unmitigated/mitigated styling of group 2 apply with zero extra inputs. // · TF: cluster boxes need a TF that divides 40m (1m..40m). The 13.3m grid // is 800 s; exact on 10s/20s/40s bars, on 1m the window edges quantise to // whole bars (up to ~1 bar smear -- same class as sessions on 1H). // Sub-boxes and levels are gated to <= 1m charts, silently, as always. // NOT CHANGED, on purpose -- both are known and now written down instead: // · Session H/L uses time()-windows on the BAR-OPEN, so on a TF that is not // 30-min aligned the boundary candle smears into the neighbouring session // (1H: the 02:00 candle counts as Asia but contains 02:30-03:00). Gating it // on ali30 like the cycles would delete session levels entirely on 45m/1H // and up, which is a bigger loss than a one-candle smear. See f_updSession. // · f_render rebuilds the whole pool on every realtime tick and the merge is // O(n^2). At the input maxima n ~ 116, so ~13k comparisons per tick. Fine // today, but it is the most expensive path in the script -- see the note // above f_render before hanging another level family off the pool. // ============================================================================= indicator("TMU Time Cycle Levels v3", "TMU Cycles v3", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 800) tz = "America/New_York" f_style(s) => s == "Dashed" ? line.style_dashed : s == "Dotted" ? line.style_dotted : line.style_solid f_size(s) => s == "Tiny" ? size.tiny : s == "Small" ? size.small : s == "Large" ? size.large : size.normal // --------------------------------------------------------------------------- // TIME CONSTANTS (minutes / seconds since NY midnight) // This block replaces the timings table that used to live only in the header. // Header and code could drift apart; now there is one place. // Asia 18:00-02:29 (wraps midnight -> tested with OR, not AND) // London 02:30-06:59 . NY AM 07:00-11:29 . NY PM 11:30-15:59 // 90M raster + all lower cycles live inside 02:30-15:59. // AM1 = the 07:00-08:29 accumulation window before the NY AM manipulation. // --------------------------------------------------------------------------- M_ASIA_A = 1080 // 18:00 M_ASIA_B = 149 // 02:29 M_LON_A = 150 // 02:30 — also the anchor of the 90M/30M/10M raster M_LON_B = 419 // 06:59 M_AM_A = 420 // 07:00 M_AM_B = 689 // 11:29 M_PM_A = 690 // 11:30 M_PM_B = 959 // 15:59 — also the last minute of the 90M raster // Anchor clusters (rev 2026-08-22), in SECONDS since NY midnight: ANC1 = 14400 // 04:00 ANC2 = 36000 // 10:00 ANC3 = 43200 // 12:00 HALF40 = 2400 // half cluster width = one 40m cycle on each side C13 = 800 // one 13.3m cycle (13m20s) // --------------------------------------------------------------------------- // TYPES (see fix 8) // Sess = one liquidity source with its own reset rule (4 sessions + week + month) // Lvl = one sealed high or low kept in history (prev-day, C2) // Acc = the running high/low of a C2 window that has not sealed yet // PLvl = one entry in the render pool, before merging // --------------------------------------------------------------------------- type Sess float hp = na int ht = na float lp = na int lt = na int mitH = na // na = not yet mitigated int mitL = na bool has = false type Lvl float price = na int t = na // time of the extreme itself int mit = na // na = not yet mitigated int ty = 0 // 0 = high, 1 = low int win = 0 // anchor window 0-5 (see table above f_ancWin; unused for prev-day) type Acc float h = na int ht = na float l = na int lt = na type PLvl float price = na int start = na int mit = na string name = "" int ty = 0 // 0 = high, 1 = low int rank = 0 // 0 open . 1 session/C2 . 2 day . 3 week . 4 month int style = -1 // index into the opening-line style arrays, -1 = none int sort = 0 // label order within a merged group // --------------------------------------------------------------------------- // 1 GENERAL // --------------------------------------------------------------------------- gGen = "1 General" extendBars = input.int(30, "Extend line (bars beyond live candle)", minval = 0, group = gGen) // --------------------------------------------------------------------------- // 2 LIQUIDITY H/L // --------------------------------------------------------------------------- gLiq = "2 Liquidity H/L" liqAsia = input.bool(true, "Asia", inline="lq1", group=gLiq) liqLon = input.bool(true, "London", inline="lq1", group=gLiq) liqNYAM = input.bool(true, "NY AM", inline="lq2", group=gLiq) liqNYPM = input.bool(true, "NY PM", inline="lq2", group=gLiq) liqPD = input.bool(true, "Prev Day", inline="lq3", group=gLiq) liqPW = input.bool(true, "Prev Week", inline="lq3", group=gLiq) liqPM = input.bool(true, "Prev Month", inline="lq4", group=gLiq) prevDayCount = input.int(3, "Show prev. days", minval=1, maxval=20, group=gLiq, tooltip="How many of the most recent prev-day highs/lows you want to see back in time.") pdDef = input.string("Calendar (00:00-23:59)", " └ prev. day definition", options=["Calendar (00:00-23:59)","Trading day (18:00-17:00)"], group=gLiq, tooltip="Calendar = the original definition; note that a calendar day INCLUDES its own 18:00-23:59 evening, which is the Asia open of the NEXT trading day -- so Prev. Day H/L can land on last night's Asia session. Trading day = 18:00 -> 17:00 NY; the day seals on the 18:00 open, Sunday evening simply belongs to Monday's trading day.") showMitPrevDay = input.bool(false, " └ also keep mitigated prev-days", group=gLiq, tooltip="Off = only still-unmitigated. On = the N most recent prev-days regardless of mitigation (mitigated ones stop dotted at their mitigation point).") pdDateOn = input.bool(true, " └ date in prev-day label", group=gLiq, tooltip="Adds dd/mm to the prev-day label, e.g. 'Prev. Day L · 08/08'. With unmitigated-only display a prev-day level can be many days old (every low in between got swept); without the date it reads as yesterday's. The date is that of the CANDLE that made the level -- in Trading-day mode a low made Sunday evening therefore shows Sunday's date even though it belongs to Monday's trading day.") pdMaxAge = input.int(0, " └ max. prev-day age (days, 0 = off)", minval=0, maxval=90, group=gLiq, tooltip="Stops the backward walk after this many sealed prev-days, even if fewer than 'Show prev. days' unmitigated levels were found. 0 = walk the whole history (old behaviour). Counts sealed days, so with 'skip Sunday evening' on, skipped Sundays do not count.") skipSunEve = input.bool(false, " └ skip Sunday evening (Calendar mode)", group=gLiq, tooltip="Only relevant when prev. day definition = Calendar: there Sunday 18:00-24:00 is a 6-hour day and gives a short level. On = leave that day out of the history. In Trading-day mode this stub day does not exist and the toggle does nothing. Friday is closed correctly on the Sunday 18:00 bar either way.") pdCal = pdDef == "Calendar (00:00-23:59)" liqUnmitC = input.color(color.new(#B0BEC5, 0), "Unmitigated", inline="lqU", group=gLiq), liqUnmitW = input.int(1,"",minval=1,maxval=5,inline="lqU",group=gLiq), liqUnmitS = input.string("Solid","",options=["Solid","Dashed","Dotted"],inline="lqU",group=gLiq) liqMitC = input.color(color.new(#607D8B, 0), "Mitigated", inline="lqM", group=gLiq), liqMitW = input.int(1,"",minval=1,maxval=5,inline="lqM",group=gLiq), liqMitS = input.string("Dotted","",options=["Solid","Dashed","Dotted"],inline="lqM",group=gLiq) liqTsz = input.string("Small", "Text size", options=["Tiny","Small","Normal","Large"], group=gLiq) liqMerge = input.int(0, "Merge tolerance (ticks)", minval=0, group=gLiq, tooltip="Levels within this distance are placed on 1 line. Also applies between liquidity and opening lines. 0 = exactly equal.") liqPrice = input.bool(false, "Price in label", group=gLiq) // Fix 12. Only has an effect on a group that contains an opening line: that // group keeps running (an open does not mitigate) and therefore shows no // dotted style, so a mitigated liquidity member inside it is invisible. liqMarkMit = input.bool(false, "Mark mitigated level merged with an open", group=gLiq, tooltip="A liquidity level that sits at the same price as an opening line keeps the open's style and keeps running, so you cannot see that the liquidity side is already taken. On = that member gets '(m)' in the label, e.g. 'Prev. Day H (m) + 09:30'. Off = the old label.") // --------------------------------------------------------------------------- // 3 OPENING LINES (on . colour . width . style) // --------------------------------------------------------------------------- gOpen = "3 Opening lines" o930On = input.bool(true, "09:30", inline="o1", group=gOpen), o930C = input.color(#EF5350, "", inline="o1", group=gOpen), o930W = input.int(1,"",minval=1,maxval=5,inline="o1",group=gOpen), o930S = input.string("Dotted","",options=["Solid","Dashed","Dotted"],inline="o1",group=gOpen) woOn = input.bool(true, "W.O.", inline="o2", group=gOpen), woC = input.color(#FFA726, "", inline="o2", group=gOpen), woW = input.int(1,"",minval=1,maxval=5,inline="o2",group=gOpen), woS = input.string("Dotted","",options=["Solid","Dashed","Dotted"],inline="o2",group=gOpen) moOn = input.bool(true, "M.O.", inline="o3", group=gOpen), moC = input.color(#AB47BC, "", inline="o3", group=gOpen), moW = input.int(1,"",minval=1,maxval=5,inline="o3",group=gOpen), moS = input.string("Dotted","",options=["Solid","Dashed","Dotted"],inline="o3",group=gOpen) coOn = input.bool(true, "C.O. (90M)", inline="o4", group=gOpen), coC = input.color(#42A5F5, "", inline="o4", group=gOpen), coW = input.int(1,"",minval=1,maxval=5,inline="o4",group=gOpen), coS = input.string("Dotted","",options=["Solid","Dashed","Dotted"],inline="o4",group=gOpen) openTsz = input.string("Small", "Text size", options=["Tiny","Small","Normal","Large"], group=gOpen) // --------------------------------------------------------------------------- // 4 OPENING GAPS (box + CE line) // --------------------------------------------------------------------------- gGap = "4 Opening gaps" nwogOn = input.bool(true, "NWOG", inline="g1", group=gGap), nwogBoxC = input.color(color.new(#26A69A, 85), "Box", inline="g1", group=gGap), nwogCEC = input.color(#26A69A, "CE", inline="g1", group=gGap) nwogHist = input.int(2, "NWOG history", minval=1, maxval=20, group=gGap) ndogOn = input.bool(true, "NDOG", inline="g2", group=gGap), ndogBoxC = input.color(color.new(#FFA726, 85), "Box", inline="g2", group=gGap), ndogCEC = input.color(#FFA726, "CE", inline="g2", group=gGap) ndogHist = input.int(5, "NDOG history", minval=1, maxval=20, group=gGap) // --------------------------------------------------------------------------- // 5 90M CYCLE BOXES — box only (their C2 levels are gone, see 2026-08-22) // Red (manipulation) windows always keep the M colour. // --------------------------------------------------------------------------- gCyc = "5 90M cycle boxes" cyc90 = input.bool(true, "90M boxes", group=gCyc) cyc30 = input.bool(true, "30M boxes", inline="lo", group=gCyc) cyc10 = input.bool(true, "10M boxes", inline="lo", group=gCyc) loInRed = input.bool(false, " └ 30/10 only inside RED 90M", group=gCyc, tooltip="Off = normal full AMD 30M/10M across 02:30-15:59 (the whole raster). On = only inside the red (manipulation) 90M windows, for a calmer chart.") amdBlue = input.color(#2962ff, "A", inline="amdc", group=gCyc) amdRed = input.color(#f23645, "M", inline="amdc", group=gCyc) amdGreen = input.color(#089981, "D", inline="amdc", group=gCyc) mode90 = input.string("Grey", "Non-red 90M windows", options=["Hide","Grey","AMD colours"], group=gCyc, tooltip="Hide = only the red (manipulation) 90M windows (LO2/AM2/PM2: 04:00, 08:30, 13:00 NY). Grey = all 90M windows, the non-red ones in the colour below. AMD colours = original blue/red/green rotation. The red windows always keep the M colour.") c90OtherC = input.color(color.new(#B0BEC5, 0), " └ colour non-red 90M", group=gCyc) cycTrans = input.int(85, "Box transparency", minval=0, maxval=100, group=gCyc) cycBordStr = input.string("Dotted", "Border", options=["Solid","Dashed","Dotted"], inline="cb", group=gCyc) cycBordC = input.color(color.gray, "", inline="cb", group=gCyc) cycEQon = input.bool(true, "EQ line (90M + sessions)", inline="ceq", group=gCyc) cycEQred = input.bool(false, " └ only in RED 90M", group=gCyc, tooltip="Keeps the chart calm when all 90M windows are visible: the EQ line is then only drawn in the red windows (sessions keep theirs).") cycEQstr = input.string("Dashed", "", options=["Solid","Dashed","Dotted"], inline="ceq", group=gCyc) cycEQC = input.color(color.gray, "", inline="ceq", group=gCyc) // --------------------------------------------------------------------------- // 6 ANCHOR CLUSTERS (04:00 / 10:00 / 12:00 NY — see rev 2026-08-22) // Level styling reuses the unmitigated/mitigated rows of group 2. // --------------------------------------------------------------------------- gAnc = "6 Anchor clusters (04:00 / 10:00 / 12:00)" ancOn = input.bool(true, "Anchor clusters (module)", group=gAnc, tooltip="Master switch for the whole module: boxes AND levels. The three parts below can be toggled separately. Deliberately only the anchors 04:00 / 10:00 / 12:00 NY: three windows a day, no overtrading. Star label: 12:00 = 4-star, the others 3-star.") anc40On = input.bool(true, "40m cluster box (anchor -40m .. +40m)", group=gAnc, tooltip="The soft red box: 03:20-04:40, 09:20-10:40, 11:20-12:40 NY. Off = only the 13.3 sub-boxes and/or levels remain. Needs a TF that divides 40m (1m..40m).") ancBoxC = input.color(color.new(#f23645, 88), "Fill", inline="an1", group=gAnc) ancBordC = input.color(color.new(#f23645, 40), "Border", inline="an1", group=gAnc) ancBordS = input.string("Dotted", "", options=["Solid","Dashed","Dotted"], inline="an1", group=gAnc) anc13On = input.bool(true, "13.3 sub-boxes (C1/C2)", inline="an13", group=gAnc, tooltip="The two anchor-adjacent 13.3m cycles: C1 = the last 13.3 before the anchor, C2 = the first after it. They have their OWN fill (next to this toggle) so they stay visible as boxes when the 40m cluster box is off -- with the cluster on, the two fills stack and the 13.3s read slightly more saturated, like the star blocks in the ladder. Only on <= 1m charts; the 800 s grid is exact on 10s/20s/40s bars, on 1m the edges quantise to whole bars.") anc13FillC = input.color(color.new(#f23645, 82), "fill", inline="an13", group=gAnc) ancLvlOn = input.bool(true, "13.3 H/L levels", inline="an2", group=gAnc) ancLineC = input.color(color.new(#f23645, 0), "13.3 line style", inline="anL", group=gAnc) ancLineW = input.int(1, "", minval=1, maxval=5, inline="anL", group=gAnc) ancLineS = input.string("Solid", "", options=["Solid","Dashed","Dotted"], inline="anL", group=gAnc) ancCount = input.int(1, " history per level", minval=1, maxval=5, inline="an2", group=gAnc, tooltip="How many of the most recent C1/C2 highs/lows to keep per window. They join the normal level pool: merge, mitigation and the unmitigated/mitigated colours/widths of group 2 apply automatically. Only accumulated on <= 1m charts.") // --------------------------------------------------------------------------- // 7 SESSION BOXES // --------------------------------------------------------------------------- gSbox = "7 Session boxes" sbAsia = input.bool(true, "Asia", inline="sb1", group=gSbox), sbAsiaC = input.color(color.gray, "", inline="sb1", group=gSbox) sbLon = input.bool(false, "London", inline="sb2", group=gSbox), sbLonC = input.color(#2962ff, "", inline="sb2", group=gSbox) sbNYAM = input.bool(false, "NY AM", inline="sb3", group=gSbox), sbNYAMC = input.color(#f23645, "", inline="sb3", group=gSbox) sbNYPM = input.bool(false, "NY PM", inline="sb4", group=gSbox), sbNYPMC = input.color(#089981, "", inline="sb4", group=gSbox) sbLblC = input.color(color.black, "Label", inline="sbl", group=gSbox) sbLblSz = input.string("Small", "", options=["Tiny","Small","Normal","Large"], inline="sbl", group=gSbox) amd_col(int idx) => int m = idx % 3 m == 0 ? amdBlue : m == 1 ? amdRed : amdGreen // --------------------------------------------------------------------------- // STATE // sessSt: 0 Asia . 1 London . 2 NY AM . 3 NY PM . 4 Prev Week . 5 Prev Month // (fix 9: the old 7-slot layout had a dead index 4 left over from when the // prev-day lived in the same array. Week/month moved down one slot.) // --------------------------------------------------------------------------- var array sessSt = array.from(Sess.new(), Sess.new(), Sess.new(), Sess.new(), Sess.new(), Sess.new()) var float cdH=na, var int cdHt=na, var float cdL=na, var int cdLt=na var float cwH=na, var int cwHt=na, var float cwL=na, var int cwLt=na var float cmH=na, var int cmHt=na, var float cmL=na, var int cmLt=na // Prev-day history. One Lvl per sealed high/low; .mit holds the mitigation time. var array pdHi = array.new() var array pdLo = array.new() // Anchor-cluster 13.3m windows, w = cluster*2 + [C1=0 | C2=1] (see the // window table above f_ancWin). Six separate Acc objects on purpose -- // array.new(6, Acc.new()) would be six references to ONE object. var array ancAcc = array.from(Acc.new(), Acc.new(), Acc.new(), Acc.new(), Acc.new(), Acc.new()) var array ancLv = array.new() // Opening lines state var float o0930p=na, var int o0930t=na var float woP=na, var int woT=na var float moP=na, var int moT=na var float coP=na, var int coT=na var array gLines = array.new() var array