Navigation: Backtest Engine Details >

Scaling In or Out of Positions





Individual strategies cannot scale in or out of positions. The entry is "all in" and the exit is "all out". However, because RealTest supports simultaneous strategies in the model, it is possible to simulate scaling by using two or more versions of the same strategy with slightly different entry and exit rules.

For example, say you wanted to put half your account in SPY when the 50/200 cross occurs, then add the rest when it’s up 10% from there. This pair of strategy definitions would accomplish that:

As an exception to the above statement, there is an option to allow overlapped trades in the same symbol (pyramiding) within a strategy. By default, RealTest will skip a signaled trade if that strategy already has a position in that stock. If this option is enabled, RealTest will take a new position in the same stock (recorded as a separate trade) if the entry is signaled, there is sufficient capital, etc.

To enable pyramiding, add "Pyramid: True" to a strategy definition and/or the Defaults section.  To emulate the non-pyramiding behavior when pyramiding is enabled, add " and Combined(Shares) = 0" to your EntryRule.

While the pyramiding option may be useful in certain kinds of strategies, it was added primarily to support research and data-gathering. For example, you might want to test a certain exit rule for every possible entry date, which would not be possible without this option.

Here is a simple example where SPY was bought every day at the close and then sold on either the first up day or the first down day. (As usual, we find that the mean-reversion exit performs better than the trend-following exit.)




Copyright © 2020-2022 Systematic Solutions, LLC