Open position investment limit for a strategy or group of strategies
Any formula specifying a dollar amount
In legacy mode this formula is evaluated before new positions are entered each day. In Top-Down Mode MaxInvested is evaluated during the setup selection process. Read "Entry" as "Setup", EntryScore as SetupScore, "position entered" as "setup kept", etc. in all references below when using top-down mode.
When present, this formula is evaluated before new positions are entered each day.
The Investment of a position is its quantity times its entry price.
A position is only entered if its investment value plus the initial investment values of all currently open positions in that strategy would not exceed the value returned by this formula for that day.
If a position can not be entered due to this constraint and the strategy specifies Reduce: True, then the position's Quantity will be reduced to allow the position to be entered at smaller size if possible.
When entries are skipped because of this investment cap, EntryScore is used to determine which positions are entered and which are skipped.
Entries skipped for this reason display "max invested" in the Reason column of the Trade List, provided that the KeepTrades setting included Skipped.
If MaxInvested is not specified then there is no limit placed on the dollar investment level, though there might still be investment limits if the strategy specifies MaxExposure and/or MaxPositions.
For the typical scenario where investment should be capped at the strategy's current allocation, use MaxInvested: S.Alloc.
To allow twice the allocation to be invested, use MaxInvested: 2 * S.Alloc, and so on.
How this maps to "margin" usage depends on the definition of S.Alloc.
In the default case, when Allocation is not specified, MaxInvested: S.Alloc will allow a new position to be entered if its dollar value plus the combined initial position sizes of other open positions does not exceed current account size (net liquidation value), which includes mark-to-market value of open positions.
This means that when specified this way, position slots that were not previously available might become available as existing positions appreciate in value, thus creating more buying power. Note that this implies use of a "margin account", even though "margin leverage" is not being used.
To model a cash account where only closed trades can change strategy allocation, add MarkToMarket: False to the strategy.
See Also: Backtest Engine Details and Capacity Constraints