Learn about QuantScript: a scripting language for automated trading with JavaScript-like syntax, broker-portable execution, built-in risk management, and AI-friendly design. Try free at quantscript.com.
QuantScript exists to lower friction across the full lifecycle of quantitative trading — from data sourcing and exploration, through technical analysis and backtesting, to paper trading and live deployment.
Today, quant traders juggle multiple tools: Python for research, Pine Script for charting, MQL5 for live execution, and custom adapters to connect them. QuantScript consolidates these into a single, coherent language with standard JavaScript syntax, reducing context switching and improving productivity.
Try QuantScript in your browser at quantscript.com/playground — no installation required.
We believe the scripting language for quantitative finance should be:
Standard let, const, if, for, arrow functions, destructuring, optional chaining, nullish coalescing. Only one custom keyword: mode.
Explicit object arguments over positional lists. Stable, consistent naming. Predictable return shapes. Structured error messages with machine-readable metadata.
The same strategy script runs across MT5, crypto exchanges, and equities brokers via an adapter pattern. Capability discovery through trade.capabilities().
Draws philosophical inspiration from Pine Script, MQL5, CCXT, and JavaScript — but intentionally avoids legacy syntax lock-in. It's its own thing.
Runtime risk limits, kill switches, capability checks, and mode guardrails. The risk() declaration enforces position limits and daily loss caps.
Reproducible at candle level. Every signal, order, fill, and position update is event-sourced for auditability.
Named, aligned time-series columns are native to the language. Each expression computes one value per frame; values accumulate into full columns.
FrameModel serves as the Single Source of Truth. Renderers subscribe to state-change events. The event.* namespace provides callbacks for ticks, candles, orders, deals, and positions.
event.onCandle() drives frame-by-frame execution. Each frame computes one value per expression.Seven core types define the universal trading primitives:
| Type | Purpose |
|---|---|
QSOrderRequest | Object-shaped order submission with explicit fields |
QSOrder | Runtime order representation with lifecycle tracking |
QSFill | Single execution event with fee details |
QSPosition | Aggregated exposure with PnL and margin |
QSAccount | Account snapshot (balance, equity, buying power) |
QSSymbolInfo | Normalized instrument metadata |
BrokerCapabilities | Runtime feature discovery |
broker("sim", { execution_strategy: "bar-match-netting" }); // CFD/forex
broker("sim", { execution_strategy: "crypto-spot" }); // Spot crypto
broker("sim", { execution_strategy: "us-equities" }); // US stocks| Inspiration | What We Took | What We Changed |
|---|---|---|
| Pine Script | Concise indicator syntax, ta.* namespace, chart-first design, per-bar execution model |
Standard JS syntax. Explicit event.onCandle(). null instead of na. Hex colors. |
| MQL5 | Trading execution rigor, event-driven lifecycle, strategy/indicator separation | CCXT-style trade.* API. Object parameters. Capability discovery instead of compile-time broker coupling. |
| CCXT | Broker-portable API design, camelCase naming, unified object parameters | Integrated directly into the language runtime. Extended with execution strategies for backtest simulation. |
| pandas / numpy | DataFrame as the core data primitive, named aligned columns | Native to the language. Frame-by-frame execution model instead of vectorized operations. |
| JavaScript (ES6+) | Full standard syntax: let/const, arrow functions, destructuring, optional chaining |
Only one addition: the mode keyword. Named arguments via key: value syntax. |
Build and backtest indicators and strategies in a single language. Write once, run in backtest, paper, or live mode.
Rapid prototyping of technical analysis pipelines and automated trading logic. Familiar JavaScript syntax means no learning curve.
Explore datasets, compute features, and visualize results — all within the same environment you'll eventually deploy to.
Explicit object parameters, predictable shapes, stable naming conventions, and canonical examples make it ideal for AI-assisted strategy development.