Backtest Lab Docs
Order Sizing and Accounts
When a trading strategy generates an entry signal, Backtest Lab must determine how many shares to trade and whether sufficient capital is available to execute the order.
These decisions are controlled by the Order Sizing Type selected in the backtest configuration.
Backtest Lab currently supports four sizing types:
- Fixed Quantity
- Fixed Value
- Fixed Value with Balance
- Slot-Based
Each sizing type uses a different approach to calculating order quantities and managing trading capital.
Fixed Quantity
Fixed Quantity is the simplest sizing model.
Every trade entry requests the same number of shares, regardless of the symbol's price or the amount of capital required.
For example, if the configured quantity is 100 shares:
- A trade in a share priced at ₹200 requests 100 shares.
- A trade in a share priced at ₹500 also requests 100 shares.
This sizing type assumes unlimited funds, so orders are not rejected because of insufficient account balance.
Fixed Quantity is useful when you want to evaluate trading signals using a consistent number of shares per trade, without imposing capital constraints.
Fixed Value
Fixed Value attempts to allocate a specified amount of capital to each trade.
Instead of using a fixed number of shares, Backtest Lab calculates the order quantity based on the latest available price, aiming to keep the estimated order value as close as possible to the configured amount without exceeding it.
For example, suppose you configure an order value of ₹10,000.
If the latest available share price is ₹250, the strategy can request:
₹10,000 ÷ ₹250 = 40 shares
Since equities are traded in whole shares, quantities are rounded down where necessary.
Like Fixed Quantity, this model assumes unlimited funds. Trades are not rejected because of insufficient account capital.
Estimated vs. Actual Order Value
An important detail is that the quantity is calculated using the latest available price when the order is generated.
However, the actual execution price may be different.
For example, if an order for 40 shares is calculated using ₹250 but executes at ₹255, the actual order value becomes ₹10,200.
The configured fixed value is therefore a target for calculating quantity, not a guaranteed limit on the final executed order value.
This behavior follows Backtest Lab's candle-based Evaluation Timeline.
Fixed Value with Balance
Fixed Value with Balance calculates order quantities in the same way as Fixed Value, but introduces a finite trading account balance.
You configure:
- The target value per order.
- The starting account balance.
Every executed trade uses capital from the account. As trades are opened and closed, the available balance changes accordingly.
For example, suppose you configure:
- Starting balance: ₹1,00,000
- Order value: ₹20,000
The strategy attempts to size each entry to approximately ₹20,000.
However, if insufficient capital is available when an order is to be executed, the trade is rejected.
This makes the model suitable for testing a strategy under realistic capital constraints.
When multiple symbols are included in a backtest, they all draw from the same account balance. Learn more about Shared Account.
Slot-Based
Slot-Based sizing divides the trading account into a fixed number of slots, limiting how many trades can be open simultaneously.
You configure:
- The starting account balance.
- The number of slots.
Each live trade occupies one slot. When the trade closes, its slot becomes available again.
The capital available for new entries is distributed across the remaining free slots.
Example
Suppose you configure an account with:
- Starting balance: ₹1,00,000
- Number of slots: 4
Initially, all four slots are available, so each slot represents an allocation of approximately ₹25,000.
When a trade is opened, it occupies one slot.
As the account balance changes and slots become occupied or available, the capital allocated to subsequent entries is recalculated using the available balance and free slots.
If all four slots are occupied, no additional trades can be opened until a slot becomes available.
Slot-Based sizing is useful when you want to limit the number of simultaneous positions while distributing available capital across trading opportunities.
Maximum Live Orders per Share
In addition to the order sizing type, Backtest Lab allows you to configure Max Live Orders per Share.
This setting limits the maximum number of trades that can remain open simultaneously for any individual symbol.
For example, if the limit is set to 2, a strategy can have at most two live trades in Reliance at any given time.
If two Reliance trades are already open and another entry is requested, the new trade is rejected.
The same limit applies independently to every selected symbol.
This restriction is separate from the account's capital and slot limits. A trade must satisfy all applicable constraints before it can be executed.