Appearance

Personalize your experience

Mode
Accent Color
Direction
All Docs/QuaScript//
QuaScript logo

QuaScript Documentation

Language guide, engine API, 601 builtins and the preset library · v3.0.0-phase1

Collections

Five containers, each with one job:

ContainerHoldsUse it for
arraya fixed number of numbers, as a ringrolling windows: array.roll is O(1)
lista growable sequence of numbers, text, colors or structszones, pivots, levels
mapkey → value (number or text keys)per-session or per-time-of-day statistics
grida 2-D matrix of numberscorrelation tables, heat maps
tablerows with named, typed columnstrade journals, summaries (draw.table.from shows one)

A collection declared with persist lives for the whole run. A collection created without persist is cleared and reused at the same call site on every bar, so steady state allocates nothing.

array

QuaScriptengine result
Loading the engine result…
array.qs
analysis "Rolling window" { overlay = false }

persist w = array.create(50, 0.0)
array.roll(w, close - close[1])        // drop the oldest value, add the newest
render.line(array.mean(w), "Mean change")
render.line(array.percentile(w, 90), "90th percentile")
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

Reductions and transforms: sum mean min max stdev variance percentile rank zscore argmin argmax sort reverse normalize cumsum diff dot correlation covariance linreg slice copy, element-wise add sub mul div.

list

QuaScriptengine result
Loading the engine result…
list.qs
analysis "Recent pivots" { overlay = true }

persist highs = list.create(float)
ph = ta.pivot_high(5, 5)
if not math.is_na(ph) {
    list.push(highs, ph)
    if list.size(highs) > 10 { list.shift(highs) }
}
render.step(list.size(highs) > 0 ? list.max(highs) : na, "Highest of last 10 pivots")
levels = [1.0, 1.272, 1.618]           // a list literal
render.line(close * list.get(levels, 0), "Literal")
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

push pop shift unshift insert remove get set first last size clear contains index_of slice copy sort sort_by reverse fill sum mean min max stdev percentile. list.sort_by(zones, "top") sorts a list of structs by a field; list.get(zones, i).field reads one field without copying the row.

map

QuaScriptengine result
Loading the engine result…
map.qs
analysis "Range by weekday" { overlay = false }

persist avg_range = map.create(float, float)
day = time.weekday()
prev = map.get(avg_range, day, high - low)
map.set(avg_range, day, prev + ((high - low) - prev) * 0.1)
render.histogram(map.get(avg_range, day), "Typical range today")
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

set get has remove size clear keys values copy. Keys are kept in insertion order.

grid

QuaScriptengine result
Loading the engine result…
grid.qs
analysis "Grid" { overlay = false }

g = grid.create(2, 2, 0.0)
grid.set(g, 0, 0, ta.rsi(close, 14))
grid.set(g, 1, 1, ta.rsi(close, 28))
render.line(grid.sum(g) / 2, "Mean RSI")
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

create get set rows cols row col add_row remove_row fill copy transpose multiply sum mean.

table

QuaScriptengine result
Loading the engine result…
journal.qs
analysis "Journal" { overlay = true }

persist j = table.create("bar", int, "price", float, "kind", text)
if ta.cross_up(close, ta.sma(close, 20)) { table.add_row(j, bar.index, close, "up") }
if table.rows(j) > 20 { table.remove_row(j, 0) }
if bar.is_last { draw.table.from(j, at = anchor.bottom_right, max_rows = 10) }
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

create add_row remove_row get set rows columns column find filter sort_by top aggregate copy clear. table.filter, table.top and table.aggregate write into a result table owned by the call site.

Limits

Lists and maps hold at most 100,000 elements, arrays and grids 1,000,000, tables 100,000 rows by 64 columns. Reading outside a collection gives na and one W_INDEX_RANGE warning per call site; writing outside is ignored.


© 2026 Quatick Technologies. All rights reserved.