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

Libraries

A library is a file of reusable code. Scripts load as many libraries as they need, libraries can load other libraries, and libraries can be organised in folders.

presets/library/smc/zones.qs
library "smc/zones"
/// Price zones with mitigation tracking.
use "smc/structure" as st

pub DEFAULT_ATR = 14

pub struct Zone {
    top: float = na
    bottom: float = na
    bullish: bool = true
    fn mid(self) -> float { return (self.top + self.bottom) / 2 }
    fn mitigated(self) -> bool { return self.bullish ? close < self.bottom : close > self.top }
}

pub fn fvg(min_atr: float = 0.1) -> (bool, Zone) {
    a = ta.atr(DEFAULT_ATR)
    bull = low > high[2] and low - high[2] >= a * min_atr
    bear = high < low[2] and low[2] - high >= a * min_atr
    z = Zone(top = bull ? low : low[2], bottom = bull ? high[2] : high, bullish = bull)
    return (bull or bear, z)
}

Using libraries

QuaScriptengine result
Loading the engine result…
uses.qs
analysis "Zones" { overlay = true }

use "smc/zones"                  // alias: zones (the last part of the name)
use "smc/structure" as st
use "viz/palette" as pal

(found, gap) = zones.fvg(0.2)
persist kept = list.create(zones.Zone)
if found { list.push(kept, gap) }
render.mark(found, shape = shape.square, at = anchor.below_bar, color = pal.ACCENT)
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)
  • use "name" lines come before the other statements.
  • The alias defaults to the last segment of the name; as picks another one.
  • Only pub declarations are visible: functions, structs, enums and constants.
  • A library's types travel with it: list.create(zones.Zone), zones.Zone(top = 1), zones.Zone.factory(...).
  • Up to 16 libraries per program, nested up to 4 levels; cycles are reported with the chain.

Where libraries come from

Where the script runsLibrary search path
terminalthe bundled library folder (presets/library), plus libraries you saved in the editor
quas CLI--lib-dir DIR (repeatable), then every library and presets/library folder from the script's folder upwards
quas serve / HTTPthe libraries: [{name, source}] field of the request

use "smc/zones" loads smc/zones.qs relative to a library folder. The file must start with library "smc/zones"; a different name is an error, so a moved file is noticed.

Bundled libraries

LibraryContents
viz/paletteBULL, BEAR, NEUTRAL, ACCENT; signed_heat, osc_heat, trend_color
stats/filtersAverage enum and average(), zscore, rescale, Regime enum and regime()
smc/structureSwing struct, swings(), structure() (direction, breaks, last swing high / low)
smc/zonesZone struct with width / mid / contains / mitigated / touch, fvg(), order_block()
risk/position_sizingrisk_qty, atr_bracket, kelly_fraction
zerodhaZerodha Kite orders for bots: login, place_order, market, limit, stop_loss, stop_market, cover, protect, gtt_oco, ... (see Bots)
deltaDelta Exchange orders for bots: login, leverage, limit, market, stop_market, stop_limit, take_profit, bracket, ...
brokerthe same order calls for the other connected brokers
bots/executionconfirmation-driven helpers: settled, retry_after_reject, cancel_if_stale, reentry_ready, loss_streak_ok, risk_qty

© 2026 Quatick Technologies. All rights reserved.