Your interactive trading laboratory!
 • 
19 users online

Quantacula Help

How-To
C# API Reference
Extensions
Development Blog
API-Extensions
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

TASC-Extensions
The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
Rotation Models – a Tool for Evaluating Technical Indicators
Published by Q Glitch on 11/11/2018

Modern portfolio theory outlined the concept of periodically rebalancing a portfolio to manage risk, and to safeguard against becoming overexposed to a particular asset type. Balanced portfolios always stay 100% invested, but periodically sell off shares of an asset that has outperformed, using the proceeds to purchase another asset whose weight in the portfolio has diminished.

The concept of balancing a portfolio that is 100% invested is also manifested in stock rotation strategies like Dogs of the Dow. This strategy rebalances annually, and buys the 10 stocks of the Dow 30 that have the highest dividend yields.

Implementing a Stock Rotation Strategy

Traditional backtesting software often makes it difficult to implement a strategy that rebalances a portfolio that is 100% invested. It’s easy, for example, to create a strategy that buys and sells a stock based on a moving average crossover, but harder to model a strategy that seeks to buy the top 10 stocks in a universe of candidates, based on some criteria.

By using static variables, it would be possible to code a stock rotation model in Quantacula. However, we provided a dedicated Rotation Model to make the task far less complex, at least for certain scenarios.

The Quantacula Rotation Model

Rotation Models are a dedicated type of trading model in Quantacula, alongside their siblings the Building Block Models and C# Coded Models. They work by letting you establish a Weight Factor (expressed as a Quantacula indicator) and maintain a portfolio of the N stocks with the highest or lowest weight factor values. Rotation Models have the following parameters:

  • Weight Factor – any Quantacula indicator

  • How many Symbols – you control how many symbols to be invested in

  • Highest/Lowest -indicate whether the symbols with the highest or lowest Weight Values should be purchased

  • Rebalance Frequency – you can rebalance the portfolio daily, weekly, monthly, etc.

Rotation Model

Evaluating Indicators

Rotation Models are a great tool for evaluating the effectiveness of technical indicators, particularly oscillators. One standard interpretation of oscillators is that they indicate oversold levels when they move below a certain value, and overbought levels when they move above a value. This naturally fits into Quantacula's Rotation Models, and we can use an oscillator as the model's Weight Factor.

In the example below, we use a 14 period Relative Strength Index (RSI) on the most recent 10-year history of the Nasdaq 100 stocks, buying the 3 stocks in the index with the lowest RSI, and rebalancing daily. Commission of $4.95 per trade was used. We used an intelligent QPremium Nasdaq 100 watchlist to avoid the problem of survivorship bias and get the most accurate backtest results possible.

Rotation Model

Rotating into the stocks with the lowest RSI resulted in a net profit of 452% over the past 10 years, outperforming the SPY benchmark of 222%. Let's see what happens if we instead flip the logic and always buy the 3 stocks that have the highest RSI.

Rotation Model

That is quite a difference, with the net profit dropping to 110% and losing out to SPY. This is vivid proof of the old market adage, "buy low, sell high". Being able to quickly validate this market concept with a couple of Rotation Models in Quantacula Studio is a powerful tool for the technical analyst or trader. The ability to evaluate other indicators is simply a matter of changing the Weight Indicator. And, if you want to evaluate more complex criteria, they could always be boiled down to custom Quantacula indicator and dropped into a Rotation Model.