Sessions and units

View as MarkdownOpen the editor

param.session declares a window on the 24-hour clock in its zone, and unit on a number puts a unit picker in the field.

What it is

param.session(name, "HH:MM-HH:MM", { tz }) declares a window on the 24-hour clock and the zone it is written in. A window may wrap midnight ("22:00-04:00"). Per bar, inSession(...) says whether the bar's open sits inside the window, with daylight saving applied per bar from the zone's own rule.

unit: ["price", "ticks", "%", "atr"] on a number puts a unit picker in the field, listing the units in your order; unit_default names the one picked at first (the first listed when absent). unitToPrice(...) then turns the number into a price distance per bar.

Declare it

wrun
// session: a window in its zone.
param.session("rth", "09:30-16:00", { tz: "America/New_York", label: "Active hours" });
// number with a unit picker: the value and the unit's code.
param.number("offset", 0.0, { min: -100, max: 100, unit: ["price", "ticks", "%", "atr"], unit_default: "%" });
// A bounded int drawn as a slider: the ATR an atr-unit offset scales by.
param.int("atr_length", 14, { min: 2, max: 50, slider: true, label: "ATR length" });
// The tick size, written by the chart into a hidden setting.
market.tick_size();

tz is param.session only: the zone the window is written in, one of these, each with its own daylight-saving rule:

IndextzStandard offsetDaylight saving (one hour ahead)
0UTC (the default)UTC+0none
1America/New_YorkUTC-5second Sunday of March to first Sunday of November
2America/ChicagoUTC-6second Sunday of March to first Sunday of November
3Europe/LondonUTC+0last Sunday of March to last Sunday of October
4Europe/BerlinUTC+1last Sunday of March to last Sunday of October
5Asia/TokyoUTC+9none
6Asia/Hong_KongUTC+8none
7Asia/SingaporeUTC+8none
8Australia/SydneyUTC+10first Sunday of October to first Sunday of April
9Asia/KolkataUTC+5:30none
10America/Los_AngelesUTC-8second Sunday of March to first Sunday of November
11America/TorontoUTC-5second Sunday of March to first Sunday of November
12America/Mexico_CityUTC-6none
13America/Sao_PauloUTC-3none
14America/Argentina/Buenos_AiresUTC-3none
15Europe/ParisUTC+1last Sunday of March to last Sunday of October
16Europe/AmsterdamUTC+1last Sunday of March to last Sunday of October
17Europe/ZurichUTC+1last Sunday of March to last Sunday of October
18Europe/MadridUTC+1last Sunday of March to last Sunday of October
19Europe/RomeUTC+1last Sunday of March to last Sunday of October
20Europe/StockholmUTC+1last Sunday of March to last Sunday of October
21Europe/OsloUTC+1last Sunday of March to last Sunday of October
22Europe/CopenhagenUTC+1last Sunday of March to last Sunday of October
23Europe/WarsawUTC+1last Sunday of March to last Sunday of October
24Europe/HelsinkiUTC+2last Sunday of March to last Sunday of October
25Europe/AthensUTC+2last Sunday of March to last Sunday of October
26Europe/IstanbulUTC+3none
27Europe/MoscowUTC+3none
28Asia/JerusalemUTC+2Friday before the last Sunday of March to last Sunday of October
29Asia/RiyadhUTC+3none
30Asia/DubaiUTC+4none
31Africa/JohannesburgUTC+2none
32Asia/KarachiUTC+5none
33Asia/BangkokUTC+7none
34Asia/JakartaUTC+7none
35Asia/Ho_Chi_MinhUTC+7none
36Asia/Kuala_LumpurUTC+8none
37Asia/ShanghaiUTC+8none
38Asia/TaipeiUTC+8none
39Asia/ManilaUTC+8none
40Asia/SeoulUTC+9none
41Pacific/AucklandUTC+12last Sunday of September to first Sunday of April

The dialog shows each zone by its city (SESSION_TZ_LABELS: New York, Kolkata, Sao Paulo, ...). The list only grows at its end: a saved setting stores the index p_<name>_tz() reads, so the first nine never move and a new zone is appended. A tz outside the list refuses the build and names every id.

unit and unit_default belong to one number field (int, number, price): a range's two ends have no unit picker. market.tick_size() declares the tick size as a hidden setting the host writes before onStart(); market.price_precision() does the same for the price decimals, and market.zone() for the market's own time zone as an index into this same list (Chart context says who fills what).

What the dialog draws

a day strip with the window shaded, a start and an end on the 24-hour clock, and a zone menu
a number field with a unit picker beside it

Read it in onStart()

A session is three readers: p_<name>_start() and p_<name>_end() (minutes from midnight) and p_<name>_tz() (the zone's index). The index is what p_<name>_tz() reads and what inSession takes; SESSION_TZ_IDS and SESSION_TZ_LABELS hold the ids and the dialog's words in the same order. The rules are compiled into the module, so a session reads the same in your browser, on OpenMarket's servers and in an alert. The bar's open is bar.time() (Time and sessions).

A unit pick reaches the module as a code that never changes with the order you list: price 0, ticks 1, % 2, atr 3, read through p_<name>_unit() beside p_<name>(). The tick size is read through p_market_tick_size(), the price decimals through p_market_price_precision().

wrun
function onStart(): void {
  offset = p_offset();
  offsetUnit = i32(p_offset_unit());
  atr = new Atr(i32(p_atr_length()));
  tick = p_market_tick_size();
  sessionStart = p_rth_start();
  sessionEnd = p_rth_end();
  zone = i32(p_rth_tz());
}

Per bar, inSession(barOpenSec, startMin, endMin, zone) answers whether the bar's open sits inside the window, and unitToPrice(value, unit, close, tick, atr) turns the number into a price distance: ticks multiplies by the tick size, % takes that percent of close, atr multiplies by the ATR you pass, and price is the value as it is.

wrun
const atrValue = atr.update(bar.high(), bar.low(), close);
// The offset in the unit the dialog picked, as a price distance.
if (isFinite(basis)) basis += unitToPrice(offset, offsetUnit, close, tick, atrValue);
active = inSession(t, sessionStart, sessionEnd, zone) && multiHas(dayMask, weekday);

Chart context

Numbers about the chart and its market reach your file before the first bar: the bar interval, the price decimals, the tick size, the chart's colours, and the market's kind, point value, time zone, quote currency (The market's facts) and the minute its trade day opens (Venue trade day). Declare the ones you need at the top level and read them in onStart(). Wherever the indicator runs, it gets the numbers that place can know, and 0 for the rest.

// A close line with a corner readout of the three facts the host writes before the first bar.
chart.interval_sec();
market.price_precision();
market.tick_size();

output("close_line", line, overlay, { color: "#94a3b8" });
string("facts", { max_bytes: 96 });
render.table("corner", { rows: 1, cols: 1, cells: ["facts"], position: "top_left" });

let intervalSec: f64 = 0;
let decimals: i32 = 0;
let tick: f64 = 0;

function onStart(): void {
  intervalSec = p_chart_interval_sec();
  decimals = i32(p_market_price_precision());
  tick = p_market_tick_size();
}

function onBar(): void {
  const close = bar.close();
  if (isNaN(close)) return;
  out_close_line(close);
  sb_clear();
  sb_text("bar ");
  // 0 means the host did not fill the fact.
  if (intervalSec > 0) sb_duration(intervalSec); else sb_text("unknown");
  sb_text(", close ");
  sb_f64(close, decimals);
  sb_text(tick > 0 ? ", tick known" : ", tick unknown");
  str_facts_sb();
}

On a 15-minute BTC chart the readout says bar 15m, the close at the chart's own decimals, and tick unknown.

Who fills what

DeclareRead withOn the chartOn OpenMarket's servers and in alertsWhere there is no chart
chart.interval_sec()p_chart_interval_sec()the bar interval in seconds (a 15-minute chart reads 900)the chart's number, carried with the indicatorthe interval of the bars it runs on
market.price_precision()p_market_price_precision()the chart's price decimalsthe chart's numberthe most decimals the market's candle prices carry, at most 10; 0 when it reads no candles of that market
market.tick_size()p_market_tick_size()the market's tick where the market publishes one (CME markets), else 0the chart's number0, until market data carries tick sizes
chart.bg_color()i32(p_chart_bg_color())the background colour, packedthe chart's number0
chart.fg_color()i32(p_chart_fg_color())the text colour, packedthe chart's number0
market.kind()i32(p_market_kind())what the chart's market tradesthe chart's numberwhat the market directory says the market trades
market.point_value()p_market_point_value()the money one point of price is worth on one contractthe chart's number1 for a market priced per unit (a coin, a perpetual, a stock), 0 on a CME futures market, whose multiplier is not known there
market.zone()i32(p_market_zone())the market's exchange time zonethe chart's numberNew York for US stocks, indices and forex, Chicago for CME, London for the London metals, else 0 (UTC)
market.quote_is_usd()i32(p_market_quote_is_usd())whether prices are in US dollarsthe chart's numberfrom the market's quote currency
market.session_open()p_market_session_open()the minute the market's trade day opens on its clockyes: the hosted worker, the registry and Enterprise select the wrun8 pair (@openmarket/contracts 5.24.0, 2026-10-13)1020 on CME futures (17:00 Chicago) and on forex (17:00 New York), else 0 (midnight)
  • Read 0 as "unknown". unitToPrice leaves a ticks value as it is when the tick is 0, and a Bucket refuses its span when the interval is 0. The zone and the session open are the exceptions: the zone's 0 is UTC and the session open's 0 is midnight, also where either is unknown.
  • These are hidden settings: the settings dialog never shows them, and the number the host writes always wins over anything passed under the same name.
  • Each one counts toward the 128 settings.

The interval and the colours

wrun
// The bar interval and the chart's two colours, written by the chart into hidden settings.
chart.interval_sec();
chart.bg_color();
chart.fg_color();
  • chart.interval_sec() is the chart's bar interval in seconds, read through p_chart_interval_sec() and available from the first bar (a 15-minute chart reads 900); 0 only when the interval is unknown.
  • chart.bg_color() is the chart's background, a custom background included, and chart.fg_color() is the chart's text colour, each as the packed colour the colours kit uses ((r << 24) | (g << 16) | (b << 8) | a as a signed 32-bit integer, so white reads -1). Read them with i32(p_chart_bg_color()) and i32(p_chart_fg_color()); 0 means unavailable.
wrun
function onStart(): void {
  intervalSec = p_chart_interval_sec();
  bg = i32(p_chart_bg_color());
  fg = i32(p_chart_fg_color());
}

The text colour is the theme's, not the background's: on a custom background it may not contrast with the background. Choose ink from the background's brightness instead: red(bg), green(bg) and blue(bg) read its channels, and Read a color back draws dark words on a light chart and light words on a dark one. Treat fg_color as the theme's hint.

The market's facts

wrun
// What the market trades, its point value, its time zone and its quote, written by the host into hidden settings.
market.kind();
market.point_value();
market.zone();
market.quote_is_usd();

Each is a number, and 0 means the host does not know:

DeclareReadsValues
market.kind()i32(p_market_kind())1 crypto, 2 a stock or an ETF, 3 forex, 4 a metal, 5 an index, 6 an economic series; 0 unknown, or none of these (a prediction market, an oil contract)
market.point_value()p_market_point_value()the money one whole point of price is worth on one contract: a futures multiplier (50 on the E-mini S&P), 1 on a market priced per unit (a coin, a perpetual, a stock); 0 unknown
market.zone()i32(p_market_zone())the market's exchange time zone as its index in the zone list above (1 New York, the clock of US stocks and forex, 2 Chicago, 3 London); 0 is UTC, also where the zone is unknown
market.quote_is_usd()i32(p_market_quote_is_usd())1 when prices are in US dollars, 2 in another currency or coin (USDT and USDC included: BTCUSDT is priced in USDT), 0 unknown
market.session_open()p_market_session_open()the minute of the day, on the market's clock, at which its trade day opens: 1020 (17:00) on CME futures and on forex, 0 (midnight) on every other market and where it is unknown (Venue trade day)
  • A futures market reports what it trades: an index future reads 5, a gold future 4.
  • A stock that trades around the clock on a crypto venue reads 2 and its venue's zone, UTC.
  • The codes never change: a new kind is added at the end of the list.
  • The zone is an index, not an offset: pass it to inSession(...) or new Clock(SESSION_TZ_IDS[zone]) and each bar gets its own daylight-saving offset.
  • market.size_unit() and market.notional() declare the facts the size helpers read, so one file counts and prices a size on every market (Size units).
// A listed stock's regular hours on its own exchange clock: the close drawn only between 09:30 and 16:00 there, every bar on a market that trades around the clock.
market.kind();
market.zone();
market.point_value();
market.quote_is_usd();

output("session_close", line, overlay, { color: "#2962ff" });
output("point_value_usd", line, lower, { color: "#94a3b8" });

let kind: i32 = 0;
let zone: i32 = 0;
let pointValue: f64 = 0;
let inDollars = false;

function onStart(): void {
  kind = i32(p_market_kind());
  // 0 is UTC, also where the host does not know the zone.
  zone = i32(p_market_zone());
  pointValue = p_market_point_value();
  inDollars = i32(p_market_quote_is_usd()) == 1;
}

function onBar(): void {
  const close = bar.close();
  // A stock (kind 2) on an exchange clock keeps its hours, 09:30 (minute 570) to 16:00 (minute 960);
  // zone 0 is a venue that trades around the clock (a stock perpetual), or an unknown zone.
  const open = kind != 2 || zone == 0 || inSession(bar.time(), 570, 960, zone);
  out_session_close(open ? close : NaN);
  // A one-point move on one contract, in dollars where the market is priced in them.
  out_point_value_usd(inDollars && pointValue > 0 ? pointValue : NaN);
}
BTCUSDT perpetual on Binance, 1 hour bars, Aug 10 to Aug 18, 2026Real output from OpenMarket's engine

On a US stock the line breaks outside New York's regular hours, daylight saving included, and the lower pane reads 1. On BTCUSDT, and on a stock perpetual that trades around the clock, the line runs through every bar; on BTCUSDT the lower pane stays empty, since the price is in USDT.

Venue trade day

A CME futures trade date does not start at midnight UTC: it opens at 17:00 Chicago the evening before the date it is stamped with, and its week opens on Sunday at 17:00. A forex trade date (gold and silver on FX_OTC included) opens the same way at 17:00 New York, and its week opens on Sunday at 17:00 New York. Declare market.session_open() beside market.zone(), read both in onStart(), and the same four helpers place any bar in its trade day, so a daily or weekly anchor lands where the exchange's does.

wrun
// The market's clock and the minute its trade day opens, written by the host into hidden settings.
market.zone();
market.session_open();
HelperAnswers
sessionDayOpen(t, zone, openMin)the time, in epoch seconds, at which the trade day holding t opened
sessionTradeDate(t, zone, openMin)that trade day's date as days since 1970-01-01 (times 86400 is its 00:00 UTC stamp)
sessionWeekOpen(t, zone, openMin)the time the trading week holding t opened: the open of its Monday trade date
sessionGapBefore(prevT, t, zone, openMin)true when the bar at t sits in another trade day than the bar at prevT

t is a bar's open time (bar.time()), zone is i32(p_market_zone()) and openMin is p_market_session_open().

  • An open past 12:00 stamps the next date: on CME a bar from 17:00 Chicago on belongs to tomorrow's trade date, so Monday's trade date, and the week, open on Sunday at 17:00.
  • Where the trade day opens at midnight on UTC (crypto), the helpers return the UTC day and the UTC week from Monday: the same numbers as Math.floor(t / 86400) * 86400, to the bit.
  • Daylight saving follows the zone: the CME open stays at 17:00 on the Chicago clock in summer and in winter, and the forex open at 17:00 on the New York clock (21:00 UTC in summer, 22:00 UTC in winter).
  • There is no holiday calendar: a weekday holiday's session keeps its own date.
  • sessionGapBefore is true on the first bar of each trade day: after the daily break and the weekend on CME, at 17:00 New York on forex, after every UTC midnight on a market that trades around the clock. It is false when prevT is NaN, as on the first bar.

A session VWAP that restarts at the exchange's trade day: 17:00 Chicago on CME, 17:00 New York on forex, midnight UTC on crypto.

wrun
market.zone();
market.session_open();

output("session_vwap", line, overlay, { color: "#f59e0b" });

let zone: i32 = 0;
let openMin: f64 = 0;
let dayOpen: f64 = NaN;
let pv: f64 = 0;
let vol: f64 = 0;

function onStart(): void {
  zone = i32(p_market_zone());
  openMin = p_market_session_open();
}

function onBar(): void {
  const open = sessionDayOpen(bar.time(), zone, openMin);
  if (open != dayOpen) {
    // A new trade day: the sums restart.
    dayOpen = open;
    pv = 0;
    vol = 0;
  }
  const typical = (bar.high() + bar.low() + bar.close()) / 3;
  pv += typical * bar.volume();
  vol += bar.volume();
  out_session_vwap(vol > 0 ? pv / vol : NaN);
}

On E-mini S&P futures (ES) with hourly bars, around the switch to daylight time on 2026-03-08 (Chicago is UTC-6 before it, UTC-5 after):

Bar opens (Chicago)Trade dateTrade day openedWeek openedNew trade day
Fri 03-06 14:002026-03-06Thu 03-05 17:00Sun 03-01 17:00
Sun 03-08 17:002026-03-09Sun 03-08 17:00Sun 03-08 17:00yes, after the weekend
Mon 03-09 10:002026-03-09Sun 03-08 17:00Sun 03-08 17:00no
Tue 03-10 15:002026-03-10Mon 03-09 17:00Sun 03-08 17:00no
Tue 03-10 17:002026-03-11Tue 03-10 17:00Sun 03-08 17:00yes, after the daily break

On BTCUSDT the same file restarts at 00:00 UTC every day.

Size units

A bar's volume and a trade's size count coins on a crypto pair, shares on a stock and contracts on a futures market. Declare market.size_unit() and two helpers name the unit and turn any size into money, so one file labels and prices a size right on every market without checking the exchange.

wrun
// The facts the size helpers read, written by the host into hidden settings.
market.size_unit();
market.notional();

Neither word adds a setting of its own. market.size_unit() declares market.kind(), market.point_value() and market.zone(); market.notional() declares market.point_value() and market.zone(). A fact two words name is declared once. Read the facts in onStart() and pass them per bar:

HelperAnswers
sizeUnit(kind, pointValue, zone)the unit the market counts its size in, as a code below
notional(qty, price, pointValue, zone)what qty of that size is worth at price, in the market's quote currency: qty * price * pointValue, or NaN on a CME market whose multiplier is not known

kind is i32(p_market_kind()), pointValue is p_market_point_value() and zone is i32(p_market_zone()).

CodeLabelThe market
0unitsnone of the rules below holds: forex, a metal, an index, an economic series, a market the host does not know
1coinsa crypto kind
2sharesa stock or an ETF
3contractsa futures market

The first rule that holds decides the code:

  1. Contracts when the point value is a contract multiplier, a positive number other than 1 (50 on ES, 5 on MES), or the zone is Chicago (2), the clock only CME futures keep.
  2. Coins when the kind is crypto (1).
  3. Shares when the kind is a stock or an ETF (2).
  4. Units, code 0, otherwise.
  • The contracts rule comes first: CME bitcoin futures trade a coin (kind
    1. and still count contracts.
  • notional never prints a wrong number. On the Chicago zone a point value of 0 or 1 is a multiplier the host does not hold (a CME option on the chart, every CME market where there is no chart), so it returns NaN and a money view stays empty. The cost: a CME contract whose multiplier really is 1 reads NaN too.
  • Off the Chicago zone a point value of 0 means the host does not know it, and notional multiplies by 1.
  • The codes never change: a new unit is added at the end of the list. The kit exports the codes and their labels as WRUN_MARKET_SIZE_UNITS and WRUN_MARKET_SIZE_UNIT_LABELS, so the chart shows the same words.
Marketkind, point value, zonesizeUnitA size in money
ES (E-mini S&P 500 futures)5, 50, 23, contracts2 contracts at 6000: notional(2, 6000, 50, 2) is 600000
ES where the host does not hold its multiplier5, 0, 23, contractsnotional(2, 6000, 0, 2) is NaN
BTCUSDT perpetual1, 1, 01, coins0.5 BTC at 60000: notional(0.5, 60000, 1, 0) is 30000 (USDT)
AAPL2, 1, 12, shares100 shares at 230: notional(100, 230, 1, 1) is 23000

A volume pane in money on every market, with the unit its size counts in:

wrun
market.size_unit();

output("volume_money", histogram, lower, { color: "#26a69a" });
output("size_unit", none, lower);

let unit: i32 = 0;
let pointValue: f64 = 0;
let zone: i32 = 0;

function onStart(): void {
  pointValue = p_market_point_value();
  zone = i32(p_market_zone());
  unit = sizeUnit(i32(p_market_kind()), pointValue, zone);
}

function onBar(): void {
  out_volume_money(notional(bar.volume(), bar.close(), pointValue, zone));
  out_size_unit(f64(unit));
}

On ES a bar of 2 contracts at 6000 reads 600000 and size_unit reads 3; on BTCUSDT a bar of 0.5 BTC at 60000 reads 30000 and size_unit reads 1. Where the host does not hold ES's multiplier the money pane stays empty and size_unit still reads 3.

The dialog and the lanes

Three words hand the size unit to the host, for what the module cannot change by itself: which rows the settings dialog and the chart show, the unit a volume lane is read in, and which markets fetch an input at all. None reaches the module: the build keeps them in the sheet and compiles the same bytes without them.

WordOnWhat the host does
visible_by: { size_unit: [codes] }a typed setting (param.<kind>) or an output(...)shows the row only on markets whose size unit is listed. Elsewhere the settings dialog leaves the setting out (its value still reaches onStart()), and the chart mounts nothing for the output: no plot, no legend entry, no stats row that reads it. The module still computes every output.
currency: "Auto"a trades.* or volume_profile.cells inputreads the lane in contracts (what "Coin" reads) on a market whose size unit is contracts (3), and in dollars ("USD") on every other market.
needed_by: { size_unit: [codes] }a secondary scalar feed input(...) (scaffold 72) or a secondary tape.cells input (scaffold 95)fetches the input's lane only on markets whose size unit is listed. Elsewhere nothing is asked for it and the input reads its fill on every bar (NaN, 0 under missing: "zero", NaN under "carry"; a tape reads zero prints), never holding the run. Without the word the input is needed everywhere.
wrun
// Liquidations exist on crypto venues: no toggle and no row on futures.
param.bool("show_liq", true, { label: "Liq", visible_by: { size_unit: [0, 1, 2] } });
output("liq", histogram, lower, { visible_by: { size_unit: [0, 1, 2] } });
// One profile lane beside the candles: contracts on futures, dollars everywhere else.
input("close", ohlcv.close);
input("profile", volume_profile.cells, { max_cells: 8192, ticks_per_bar: 5, currency: "Auto" });
// The liquidations lane only where the row can show: never asked on futures.
input("liq", liquidations.liquidations, { side: "BUY", missing: "nan", needed_by: { size_unit: [0, 1, 2] } });

On ES the dialog has no Liq toggle, the chart draws no Liq row, no liquidations are fetched and the profile counts contracts; on BTCUSDT all three show and the profile is in dollars.

  • The codes are the size units above, 0 units, 1 coins, 2 shares and 3 contracts: at least one, each once. A setting's derived rows (a range's two ends, a session's three parts, a unit picker) hide with it.
  • visible_by belongs to typed settings and outputs. On input(...), plain param(...), a stats row or any other declaration it is refused by name; a stats row hides with the output it reads.
  • needed_by belongs to a secondary scalar feed input, a published feed (series.value) included, and to a secondary tape.cells input: on the first input (its rows are the grid every market needs), a time.* input, every other celled <class>.cells input and a metric composition it is refused by name. Two tapes with different floors can split the markets between them, a dollar floor on coins and shares and a contracts floor on futures (Large prints): each keeps its own floor, judged on every run. Give a row that only reads such an input the same list as its visible_by, so a market that hides the row never fetches its data. An is_new_period view on a pin equal to the chart's interval still reads 1 there: it asks nothing on any market.
  • "Auto" follows the market the indicator runs on. On an input pinned to another market it is refused: name the unit, "USD" or "Coin".
  • Every host resolves "Auto" the same way, where it plans the lane's fetch: it takes the market's size unit from the facts it holds (the point value and the zone decide contracts) and reads "Coin" on 3, "USD" on anything else, a host that knows no facts included. The kit exports the three rules for hosts: wrunLaneCurrency(currency, sizeUnit), wrunVisibleOnMarket(visibleBy, sizeUnit, setting) and wrunNeededOnMarket(neededBy, sizeUnit, setting), where setting is wrunKeyedSettingReader(params, sizeUnit, read) (below).

Keyed by a choice. A typed setting's visible_by and a tape's needed_by may name one param.choice of the file beside size_unit, with the option indexes it holds under. The two keys hold together: visible_by: { size_unit: [1], min_unit: [1] } shows the row on coin markets while min_unit picks its second choice (A tape picked by a setting).

  • size_unit stays required, and one choice at most stands beside it.
  • The choice keys its own row by the size unit alone. Where that row is hidden it reads its default: a stock chart that saved Coins reads Dollars. The module still receives the saved value.
  • An undeclared name, a setting that is no param.choice, an index the choice lacks, a second choice, a choice keyed by another choice and the row itself are refused by name.
  • An output's visible_by and a scalar feed's needed_by keep the size unit alone.
Hostcurrency: "Auto"visible_byneeded_by
The chartresolved on the chart's marketthe dialog and the chart's rows follow itthe lane is fetched only where the chart's market is listed; a tape off the list reads zero prints
OpenMarket's servers and alertsresolved from the market facts the chart sends (point value and zone; missing facts read dollars); the servers select the wrun10 pair, wrun9 since 2026-10-13admitted: the servers compute every output and the chart hides the rowsthe lane is fetched only where the facts the chart sends (kind, point value and zone) list the market's size unit (wrun10, selected 2026-10-14); Enterprise requests still ask the lane on every market until that executor fills skipped inputs; a tape's needed_by is refused by name (source.tape.needed_by) until a head admits it
Where there is no chartresolved from the venue tables: only CME futures read contracts there, and no CME rows are read there, so every lane served reads dollarsnothing changes: metric reads, watches and previews read every outputthe input reads its fill where the market's size unit is not listed (the market's facts decide it); a tape off the list is never subscribed and reads zero prints
A host on an older kitbefore scaffold 69: refused by namebefore scaffold 69: the row shows on every marketbefore scaffold 72: the sheet check drops the word and the lane is asked on every market, so the input reads the lane's data there too; only the build refuses it by name, as an unknown input option. Before scaffold 95 the sheet check refuses it on a tape by name

Gotchas

  • A tick size or an ATR of 0 means unavailable, and unitToPrice then leaves the value as it is.
  • A unit picker on a range is refused: param.range 'r' takes no unit option (a unit picker sits beside one number field, not a range).
  • A session counts as three settings and a unit list as one more toward the 128-setting cap (Picks, lanes, the cap).
  • A preset sets a session or a unit through its parts (rth_start, offset_unit, by the dialog's words for a session zone or a unit) (Presets).
  • A window fixed in the file needs no setting: it is a Session (Clock and sessions kit).
  • market.size_unit() and market.notional() are declarations: they take no arguments and stand at the top level. Per bar, call sizeUnit(...) and notional(...) with the facts read in onStart().
  • visible_by hides a row; it never stops a value. A package that has no number to show on a market writes NaN there itself, and the hidden row keeps the dialog and the chart free of an empty line.