Rebalancing Strategies

Author: Optuma Team Last updated: Sep 17, 2020 02:00

Not all backtests require an entry or exit signal. Using the Rebalancing option it’s possible to rank a universe of stocks on a specific criteria and then enter equal positions in the top ranked stocks on a specified date, and then re-rank the list again at a later date, and adjust the positions accordingly.

For example, let’s say that you want to rank the Top 200 ASX companies by 3 month returns, and then take the top 10 and enter long positions in them every quarter.

In the Back Tester module set the Test Type to Rebalance, and Long Only, with the Codes to Test set to the ASX 200 Optuma Symbol List, and the Date Range you wish to test over:

Rebalancing Strategies

Test Rules

Rebalancing Strategies

This is where you set the rules for the entries and exits, eg Next Day Open, or Signal Day Close.

Position Sizing: For rebalancing use Equity Percentage

Percent per Trade: This is the percentage of holdings you want with each entry. In this example we want to take the top 10 stocks in the rankings, so this should be set to 10% so that you are fully invested. Divide 100 by the number of positions required, eg for the top 4 positions the Percent per Trade would be 25.

Max Positions: The number of rebalancing positions required, ie 10 for the top 10

Rebalance Positions: The frequency of the rebalancing based on the ranking. You can choose from Daily, Weekly, Monthly, Quarterly, Yearly.

Brokerage Model: Option of set value (eg $20) or percentage of trade value

Brokerage: Sets the brokerage value or percentage level

Scale In Days: The trade entries will be spread out evenly over the number of scale in days

Scale Out Days: The trade exits will be spread out evenly over the number of scale out days

Min Wait Period: not required for rebalancing

Ranking Criteria

In the middle panel click the + to add the ranking criteria via the Script Editor. This can not be a boolean (true/false) condition - it has to create discrete values on which the testing universe can be ranked, such as a performance.

In this example we use 3 month performance:


And as we want to take the top 10 the Order set to Descending:

Rebalancing Strategies

Adding a Filter

The top panel allows you to add a filter for the rebalancing entries. For example, to only enter when the benchmark index is trading above its 50 day moving average will keep you out of trades when the market is trending down (in this example XJO):

M1 = MA(D1, BARS=50, CALC=Close);

D1 > M1

Rebalancing Strategies


Once the test has been run the results will be displayed in a table and Equity Curve chart. Note that the yellow flat sections in the example show when the filter is keeping you out of the market, this avoiding large drawdowns:

Rebalancing Strategies

Report Tab

This display statistical analysis of the test, including profit factor, beta, Sharpe, Calmar, Sortino and Treynor ratios, and maximum drawdown. Note that the results can be copied to clipboard under Actions and pasted in to another application, eg Word:

Rebalancing Strategies

Trade List Tab

This display all the rebalancing trades, including Maximum Adverse Excursion (MAE) and Maximum Favourable Excursion (MFE). All column headings can be clicked on to sort, and they can be exported to a .csv file under Actions.

Rebalancing Strategies

Double-click on any symbol to open a chart for that symbol to show all entries and exits:

Rebalancing Strategies