|
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:
.png)
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.
See DynamicSizing for information on howQuantity can be used differently in this special alternative strategy mode.
Per-Strategy Equity and Drawdown in Combined Tests
In a combined-compounding test (the default), each strategy's S.Equity series is its starting equity plus its own cumulative profit and loss, while its position sizes are driven by the equity of the whole account (Allocation: Combined(S.Equity)). Two consequences of this combination surprise people when they graph the individual strategies of a combined test:
•An individual equity line can go negative. Because a strategy's position sizes grow with the combined account rather than with its own results, its cumulative dollar losses can exceed its own virtual starting balance, taking its individual S.Equity line to or below zero. This is not an error. In combined mode a strategy's "own account" is only a bookkeeping series — the combined equity is the account, and it is the line that reflects what the whole system did.
•Drawdown percentages are relative to the account, not to the strategy's own equity line. Per-strategy percentage stats such as S.MaxDDPct use S.Alloc as their denominator, so in a combined test a strategy's reported drawdown measures what its losses cost the total account. A strategy can therefore show a modest MaxDD% even though its own dollar equity line went negative — the two numbers answer different questions.
To see a strategy's performance in its own terms, graph its S.TWEQ (time-weighted, "growth of $1") series, which remains meaningful even when the dollar equity line has gone negative. Alternatively, model each strategy compounding in its own separate account by giving each a StartPercent, so that sizes are driven by each strategy's own equity.
|