RealTest User Guide
RealTest User Guide

 

 

Navigation: Realtest Script Language > Syntax Element Details >

DynamicSizing

 

 

 

 

Category

Strategy Elements

Description

Determines whether strategy operates in a special dynamic sizing mode

Choices

True - use dynamic sizing mode

False - use typical entry/exit formula mode (default)

Notes

If DynamicSizing is set to True then most of the typical strategy formulas become disabled and the Quantity formula determines whether a new position or partial position is entered or exited each day.

In this mode the following elements are disallowed: EntrySetup, EntryLimit, EntryStop, EntryScore, ExitRule, ExitLimit, ExitStop, ExitQty, ExitLimitQty, ExitStopQty, ExitScore, MaxSameSym, MaxSameCat, MaxSetups, MaxEntries, Side.

Instead of the logic provided by all of the above elements, the backtest engine simple evaluates Quantity once per test period. The value returned is the "target position size" for that period.

If the target size is larger than the current size, an entry is made for the difference.

If the target size is smaller than the current size, an exit is made for the difference.

The sign of the quantity determines the side (long vs. short) of the position to establish.

If the prior position was the opposite side, all current positions are exited and then the new position is entered.

Internally RealTest implements this functionality using multiple positions per symbol, similar to the older way of simulating dynamic sizing.

The key differences are:

Quantity is simply the desired position rather than having to calculate the difference vs. current position

EntrySetup is implicitly True when quantity is larger than current position

MaxSameSym is implicitly infinite

ExitRule is implicitly true when quantity is smaller than current position

ExitScore is implicitly "-Shares" i.e. always exit the smallest sub-positions first

Shares are implicitly Extern(@thisStrat, Shares), i.e., combined quantity of all sub-positions in this strategy for this symbol

there is no way to access individual sub-positions from strategy formulas though they are still evident in the trade list, log, and orders

DynamicSizing strategies can specify any desired QtyType and, as usual, should express their target quantities in that type.

These strategies can specify any of the usual capacity constraints except for those that constrain position counts. Top-down setup selection logic works as usual, including when adding to positions.

See the two example scripts clenow_stocks_on_move.rts and clenow_stocks_on_move_dynamic.rts. These implement the same strategy logic using (a) the older approach and (b) dynamic sizing mode.

 

 

 

Copyright © 2020-2025 Systematic Solutions, LLC