Platform Settings
How script settings control backtest dates, order sizing, commission, slippage, resolution, and execution defaults.
Core
Platform Settings
For strategy scripts, the script({...}) block is not just metadata. It is the public settings surface the platform uses for validation and backtest defaults.
When these values are defined in the script, they are the source of truth for that script run.
Typical Strategy Header
script({
type: 'strategy',
priceStudy: true,
initialCapital: 100000,
orderSize: 50,
orderType: 'poe',
commission: 0.05,
commissionType: 'per',
slippage: 0,
marketType: 'crypto',
startDate: '2026-01-20',
endDate: '2026-03-15',
resolution: '15',
tradeBelowCash: false,
});
Setting Reference
| Setting | What it controls | Valid values |
|---|---|---|
type |
Whether the script is only visual or fully backtestable | 'indicator', 'strategy' |
priceStudy |
Whether plots sit on the main chart | true, false |
initialCapital |
Starting capital for the backtest | positive number |
orderSize |
Default position size used when qty is omitted from strategy.entry() |
positive number |
orderType |
How orderSize should be interpreted |
'con', 'cur', 'poe', 'non' |
commission |
Commission amount used by the engine | number |
commissionType |
How commission is applied | 'non', 'per', 'cpo', 'cpc' |
slippage |
Per-trade slippage | number |
marketType |
Market assumptions and validation | 'crypto', 'equity' |
startDate |
Backtest start date | 'YYYY-MM-DD' |
endDate |
Backtest end date | 'YYYY-MM-DD' |
resolution |
Bar timeframe for the run | '1', '5', '15', '30', '60', '1D', '1W', '1M' |
tradeBelowCash |
Whether the strategy can trade beyond available cash | true, false |
Order Size Modes
| Code | Meaning |
|---|---|
'con' |
Fixed contracts or units |
'cur' |
Size by currency amount |
'poe' |
Size by percent of equity |
'non' |
No sizing mode override |
Quantity Override Behavior
orderSize is the default quantity for strategy entries.
- if
strategy.entry()omitsqty, the engine usesorderSizetogether withorderType - if
strategy.entry()setsqty, that explicit quantity overrides the script default strategy.default_qty_value,strategy.default_qty_type, andstrategy.initial_capitalexpose those header values inside the scriptstrategy.default_qty_valueis the raw configured value, so forcurandpoesizing you should omitqtywhen you want settings-driven sizing
script({ type: 'strategy', priceStudy: true, orderSize: 5, orderType: 'con' });
strategy.entry({ id: 'default_trade', type: 'long' });
strategy.entry({ id: 'override_trade', type: 'long', qty: 2 });
Commission Modes
| Code | Meaning |
|---|---|
'non' |
No commission |
'per' |
Percentage commission |
'cpo' |
Commission per order |
'cpc' |
Commission per contract |
Public Workflow
- Define the script type and whether it overlays the price chart.
- Set the backtest window with
startDate,endDate, andresolution. - Choose portfolio behavior with
initialCapital,orderSize, andorderType. - Add realistic execution costs with
commission,commissionType, andslippage. - Only then move into the signal logic.
Common Setup Patterns
Indicator Only
script({
type: 'indicator',
priceStudy: true,
});
Simple Strategy
script({
type: 'strategy',
priceStudy: true,
initialCapital: 100000,
orderSize: 1,
orderType: 'con',
commission: 0,
commissionType: 'non',
slippage: 0,
marketType: 'crypto',
resolution: '5',
tradeBelowCash: true,
});
Basket Strategy
Basket strategies use the same script({...}) settings block. The basket itself is declared separately with symbols([...]).
Common Mistakes
- using invalid date formats instead of
YYYY-MM-DD - forgetting that
endDatemust be afterstartDate - changing
orderTypewithout changing howorderSizeshould be interpreted - assuming explicit
qtyis added on top oforderSizeinstead of overriding it - leaving commission and slippage at unrealistic values
- mixing platform settings into multiple
script(...)blocks