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

Script headers

Every script starts with a header: a kind, a title in quotes and, optionally, a block of settings, one key = value per line.

QuaScriptengine result
Loading the engine result…
header.qs
strategy "Trend Breakout" {
    overlay    = true
    capital    = 100000
    commission = 0.05
    sizing     = percent_equity
    size       = 20
}
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)
  • The header must be the first statement (comments and doc comments may come before it).
  • A script has one header. A script without a header is an analysis.
  • Values are numbers, text in quotes, true / false or a name such as percent_equity.
  • Settings can share a line when separated by commas: analysis "RSI" { overlay = false, render = webgl }.
  • Unknown settings and invalid values are compile errors that name the setting and list the valid choices.

analysis

Draws on the chart. Orders are not allowed (E_ORDER_IN_ANALYSIS).

SettingValuesDefaultMeaning
paneprice, hpane, vpanepricewhere the analysis lives: on the price pane, in an H pane of its own below it, or in V panes beside the price axis (see Panes)
height0.05 .. 0.90.2share of the chart taken by the H pane (pane = hpane only)
width40 .. 600120default width in px of the script's V panes
overlaytrue, falsetrueshorthand: false is pane = hpane (set pane or overlay, not both)
renderauto, canvas, webgl, webgpuautopreferred renderer; auto lets the chart choose (backends)
max_objects1 .. 2000500drawing objects kept per kind (the oldest are removed)
precision0 .. 12pricedecimals shown for values
formatprice, percent, volume, inheritpricehow values are labelled
scaleright, left, nonerightprice scale of a separate pane
short_titletextcompact legend title

strategy

An analysis plus a simulated broker. Everything from analysis applies, and:

SettingValuesDefaultMeaning
capitalnumber > 010000starting equity
commissionnumber >= 00cost per fill, in the unit of commission_model
commission_modelpercent, per_contract, per_orderpercent
slippagenumber >= 00adverse price move per fill
slippage_unitticks, percentticks
sizingfixed_qty, fixed_cash, percent_equity, risk_percentfixed_qtyhow an order without qty is sized
sizenumber1 (or 100 for percent_equity)quantity, cash, percent of equity, or percent of equity at risk
max_leveragenumber 0.01 .. 100nonecaps every automatically sized order so the position value stays within this multiple of equity
pyramiding1 .. 1001entries allowed in one direction
fillopen, closeopenmarket orders fill at the next bar's open, or at this bar's close
close_endtrue, falsefalseclose the position on the last bar
risk_free0 .. 10annual risk-free rate for the Sharpe / Sortino ratios
periods_per_yearauto or numberautobars per year for annualised ratios

risk_percent sizes each entry so that hitting its bracket stop loses size percent of equity. A very tight stop would make that position huge; max_leverage = 1 keeps it at or below one times equity.

bot

A strategy whose orders on confirmed live bars are published as bot signals with stable, deterministic ids (the same script, bar and order always give the same id, so a signal is never executed twice). It takes the strategy settings plus:

SettingValuesDefaultMeaning
onclose, updatecloseemit when a bar closes, or on every price update of the live bar
modepaper, livepaperwhere the terminal routes the signals

History is never live: a bot opened on 10,000 bars emits nothing until new bars arrive.

library

library.qs
library "smc/zones"

pub DEFAULT_ATR = 14
pub fn width(top: float, bottom: float) -> float { return top - bottom }

The title is the library's name, used by use "smc/zones". Names are lowercase snake_case and may contain up to three folder segments. A library has no settings block. See Libraries.


© 2026 Quatick Technologies. All rights reserved.