Navigation: Backtest Engine Details >

Asset Allocation and Position Sizing

 

 

 

 

The initial AccountSize can be defined in the Settings section of your script or via the Settings Panel.

By default this value becomes the S.StartEquity value and the initial value of S.Equity for each strategy and for the combined system.

This models combined compounding of multiple strategies in one account.

To model each strategy compounding separately in its own account, add a StartPercent to each strategy.

This partial example shows both of the above alternatives:

As a backtest runs and trades are entered and exited, all of the statistics series including S.Equity are updated.

The daily S.Equity (equity curve) value for a strategy will be the prior day's value plus the net change in value due to closed trade gains or losses plus (optionally) open position mark-to-market value changes. The combined system equity value is calculated the same way by using all positions from all strategies.

By default, S.Equity includes open position mark-to-market value, making it the Net Liquidation Value (NLV) of the account. To model a cash account, in which open position gains cannot be reinvested until the position has been closed, use the strategy-level MarkToMarket setting. The default is MarkToMarket: True. For any strategy that specifies MarkToMarket: False, S.Equity will only change when positions are exited. If no strategy marks to market, then the combined system doesn't either.

Each Strategy definition will usually include a Quantity formula, and can optionally include an Allocation formula.

Quantity is evaluated at entry time for every new position, and Allocation is evaluated at the start of every date of a backtest.

If Allocation is not specified, the default is the combined system S.Equity value when StartPercent was not specified, or the individual strategy S.Equity value when StartPercent was specified.

In formula terms, this is expressed as Allocation: Combined(S.Equity) for combined compounding or Allocation: S.Equity for individual compounding.

If the default is your desired allocation, you can simply omit it.

Another Allocation possibility is Allocation: S.StartEquity. This models an account that trades the same dollar value each day regardless of the results, that is, without compounding.

Default allocation can be overridden if desired by adding an explicit Compounded setting to the strategy.

The current value of the Allocation formula is accessible via the S.Alloc syntax.

Whether or not you define a custom allocation formula, it is advisable to use S.Alloc as your reference to current account value when specifying Quantity (position size).

If Quantity is not specified, the default position size will be S.Alloc, i.e., the entire current allocation.

By default, the Quantity formula specifies the number of shares (or contracts for futures) to buy or sell short when entering a new position. The formula can optionally be redefined as either the dollar value of the position or a percent of allocation, by adding QtyType to the strategy.

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC