Documentation
4. Strategy & Test Settings
- Created
- Jun 5, 2026
- Updated
- Jun 16, 2026
Deprecated. This page documents broker settings for the legacy TypeScript/JavaScript strategy engine. For current documentation see Writing Strategies in Pine Script.
The backtest broker model is configurable so your tests reflect realistic costs and sizing. These settings shape how orders fill and how positions are sized.
Configuration options
| Setting | Default | Meaning |
|---|---|---|
| Initial cash | 10,000 | Starting capital for the account. |
| Commission | 0 | Cost per fill. Its meaning depends on the commission type. |
| Commission type | Percent | Percent (a fraction of trade notional, e.g. 0.0005 = 5 bps), Cash per order, or Cash per contract. |
| Slippage | 0 | A fraction of fill price applied against the order's direction. |
| Sizing | 100% of equity | How position size is determined — see below. |
| Pyramiding | 1 | Maximum number of entries allowed per direction. |
| Process orders on close | Off | When on, market orders created on a bar may fill at that bar's close instead of the next bar's open. |
| Close entries rule | FIFO | FIFO closes oldest entries first; Any lets exits target specific entry IDs. |
Position sizing
Sizing has a mode and a value:
- Percent of equity — size each entry as a percentage of current equity (the default, 100%).
- Fixed cash — a fixed cash amount per entry.
- Fixed quantity — a fixed number of units/contracts per entry.
Pyramiding and entry IDs
By default pyramiding is 1, so a strategy holds at most one entry per direction. Raising it lets a strategy scale in (the Pyramiding Pullback template uses three layers). When a strategy uses named entry IDs, set the close-entries rule to Any so exits can target a specific layer; the Pine-style default of FIFO closes the oldest entry first.
Per-strategy configuration
Templates can carry their own recommended configuration — for example the Pyramiding Pullback template ships with pyramiding: 3, closeEntriesRule: "any", and 30%-of-equity sizing. Strategy code interacts with these settings through the Strategy API Reference.
Next steps
Keep your strategies between sessions.
Next: Saving & Managing Drafts