RealTest provides several Strategy Element formulas to allow you to define the capacity constraints of a strategy or group of strategies in various ways.
These include:
•MaxPositions  maximum open position count
•MaxExposure  maximum percent exposure
•MaxInvested  maximum dollars invested
•MaxNewPos  maximum new position count
•MaxNewExp  maximum new percent exposure
•MaxNewInv  maximum new dollars invested
•MaxSameCat  maximum positions in the same category
MaxSameSym  maximum positions in the same security (symbol)
MaxSetups  maximum entry setups per day (processed before other constraints, not topdown)
MaxEntries  maximum position entries per day (potential selection bias, not topdown)
By default, all of the above constraints are infinite. Therefore if you want any constraints in your strategy or set of strategies, you must provide one or more of the above formulas.
In the default topdown setup selection mode, most of the above formulas may be included in the definition of a Strategy, a StatsGroup, or the Combined system. In this mode, all constraints are applied during the Setup Selection phase of daily entry processing, such that the set of orders to generate each day would violate none of the constraints.
In the older Legacy Mode, capacity constraints can only be applied to a Strategy and are applied during Entry Simulation, modeling an order management system that handles all such constraints. With capacity constraints only applied at the Strategy level, each strategy must specify from the bottom up how to play its part in modeling your desired higherlevel allocation capacities.
See BackTest Engine Details for more information about how each of these modes works.
To apply topdown constraints to all strategies in a script, simply add a Combined section and define the constraint formulas within that section.
To apply constraints to a specific group of strategies (e.g. all longside ones), define a StatsGroup consisting of those strategies and provide the constraint formulas within it.
In the daily topdown setup selection process, a setup only becomes an order if it does not violate any constraints of its Strategy, StatsGroup(s) or Combined.
The key to how this selection process works is that first all setups are determined for all strategies and ranked by each strategy's SetupScore formula. Then an outer loop by selection turn number selects one (or optionally more) setups from each strategy and checks to see if it can still become an order given the others that have already been selected.
If you only provide Combined capacity formulas, each strategy will keep the maximum possible number of setups that would (after selecting them in turn) not violate any combined capacities.
Strategyspecific capacities can also be used to further control strategylevel exposures.
Rather than depending on the order of strategies in a script to determine which one "goes first" in the setup selection loop, a StrategyScore formula can optionally be provided. When present this formula is evaluated at each rank number in the topdown loop and determines the sequence in which each strategies will get to confirm its next setup.
To enable a strategy to select more than one setup per turn in the selection process, use MaxPerTurn to specify how many setups it can select.
One analogy to this topdown mode of capacity constraint application is that it resembles the US football annual "draft". Your capacity formulas at each level along with your StrategyScore and SetupScore formulas provide the framework for deciding who gets the next pick at each stage.
