Navigation: Realtest Script Language > Syntax Element Details >

MaxInvested

 

 

 

Category

Strategy Elements

Description

Open position investment (exposure) limit for a strategy, in dollars

Input

Any formula specifying a dollar amount

Notes

When present, this formula is evaluated before new positions are entered each day.

Positions are only entered when their net dollar value plus the combined mark-to-market value of all currently open positions in that strategy would not exceed the total dollar value returned by MaxInvested.

If MaxInvested returns 0 then no positions can be entered.

If MaxIvested is not specified then there is no limit placed on the investment level (no margin limit).

When entries have to be 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 if Skipped was included in the KeepTrades setting when the test was run.

For the typical scenario where investment should be capped at current account size, simply use S.Alloc as the MaxInvested formula.

To allow twice your account size to be invested (equivalent to a 50% margin requirement), use 2 * S.Alloc, and so on.

See the notes for the Allocation formula to understand how multi-strategy dynamic allocation works.

Another key formula that influences MaxInvested is Quantity (position size).

For more information on how the backtest engine works, see Backtest Engine Details.

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC