Harvesting Momentum: Let's Kick Tires With AmiBroker [ Part I ]

Developing indicators and strategies is great, putting them to a stress test by mr. Market is better. But how? As we speak, thinkDesktop does not have the nuts and bolts to perform proper backtesting. After much consideration I decided to invest nearly $500 by buying the AmiBroker Professional suite at the turn of the year. Next I found myself back in primary school, learning to write again ...


Over the last couple of weeks I have been studying AmiBroker’s Formula Language (AFL) like there is no tomorrow. Luckily the "Introduction to AmiBroker" by Howard Bandy (free download) is a great read and AFL has a huge and generous user base, gathered in the AmiBroker User’s List on Yahoo. Last but not least there is Tomasz Janeczko’s extensive UsersGuide with an overwhelming amount of examples.

So this post is all about backtesting. Actually it probably will be the first in a series for presenting some of the backtesting possibilities AmiBroker has to offer. And while we are discovering the AmiBroker Backtester, chances are we might come across some pretty neat portfolio strategies along the way. Stay tuned!

Harvesting Momentum

As stated in previous posts, the "momentum anomaly" is known for centuries. The gist of the momentum anomaly is that assets often continue their price momentum, defined as the change in price over a given lookback period. Momentum works well across asset classes as well as within them. So harvesting momentum really is all about follow the money.

On Seeking Alpha contributor Marc Cohn has published various strategies involving momentum based trading. One of them, "Return Like A Stock, Risk Like A Bond: 15.5% CAGR With 17% Drawdown" utilizes so called "Paired Switching" between two exchange traded funds: SPY and TLT. Marc's comprehensive system actually is a TAA strategy in its simplest appearance.


AAA Made Easy For Retail Investors

During 2013 several asset allocation strategies have been presented on this blog. However, all these studies are tailor made for the specific parameters required by the strategy involved. To accommodate the exploration of similar strategies for DIY retail investors a flexible framework would come in handy. And so we have arrived at the rationale of the "All-In-One" Adaptive Asset Allocation suite.


The AAA suite is intended for backtesting numerous asset allocation strategies like TAA, GMR, FAA but also GMRE or BRS (published by Frank Grossmann on Seeking Alpha). The suite consists of two studies:
- AAA_Allocation: for showing historical and present asset allocation (required for "live" trading).
- AAA_Equity: for getting an impression* of portfolio wise performance (non essential).
The suite supports portfolio sizes with up to 12 assets next to a cash proxy.
Rebalancing of capital between the TopX assets is equal weighted.

Flexibile Asset Allocation With C(r)ash Protection

The "Conceptual sketch" posting presented a survey for designing a portfolio that generates stable profits during every type of economic environment the investor is faced with. Stimulating as well as  challenging comments were made providing food for thought on the building blocks for such a model. During our research we came across a paper published in late 2012 by Keller and Van Putten: "Generalized Momentum and Flexible Asset Allocation (FAA), An Heuristic Approach". The interested reader is encouraged to get acquainted with the elements of FAA.


Common asset allocation strategies (like the TAA strategy) are based on the so-called "momentum anomaly", which is known for centuries. The gist of the momentum anomaly is that assets often continue their price momentum, defined as the change in price over a given lookback period. Therefore one should buy assets with the highest momentum and sell assets with the lowest momentum.

FAA incorporates new momentum factors into risk regime determination. Next to the traditional momentum factor (R) based on the Relative returns among assets, Keller and Van Putten introduced Generalized Momentum by adding these new factors: Absolute momentum (A), Volatility momentum (V) and Correlation momentum (C). In their paper Keller and Van Putten demonstrated that by expanding the traditional momentum approach, portfolio performance increases compared to the buy and hold benchmark, both in terms of return as well as risk.

Summarizing FAA, Keller and Van Putten present their strategy with an example universe of 7 index funds. Applying a 4 month lookback, from this universe at the end of each month the top 3 assets are selected through a nested ranking process of these 7 assets based on relative momentum (higher is better), volatility (lower is better) and correlations (lower is better). Last, each of the top 3 assets chosen, has to pass the absolute momentum test: if their absolute momentum is negative, just go into cash. Capital is equally allocated over the top 3 assets or if applicable into cash.

FAA was scrutinized by Empiritrage. In their full report following findings are reached:
FAA has significantly higher risk-adjusted return than an equal weight portfolio. FAA decreases maximum drawdown dramatically. FAA is robust when adjusting look-back periods. Absolute momentum can directly add value on identifying down side risk regimes and decrease maximum drawdown.

Source: Empiritrage

Conceptual sketch for an "All-Weather-Portfolio" by deploying Adaptive Risk Parity

As stated in the title, the nature of this posting is conceptual. It is a survey for designing a portfolio that generates stable profits during every type of economic environment the investor is faced with. What is about to follow is partly a compilation of the information found in several sources* along with suggestions and idea's put forward by co-researcher "Ram". This post is also an open invitation to anybody who is willing to share valuable insights for improving the model.
The goal of this quest is not about generating the highest possible returns. Instead it is about creating a portfolio with a risk profile as close as possible to cash, but with yields much higher than cash. The idea is to reduce the portfolio's overall volatility by investing in assets that naturally move in opposite directions. One of the largest hedge funds in the world, Ray Dalio's Bridgewater, applies this investment philosophy in their "All-Weather-Portfolio".

AWP is based on four premises:
  • The future is unknown and impossible to predict.
  • Assets are responding to two drivers: economic cycle (expansion/contraction) and inflation (high/low).
  • Asset classes thrive not equally during each of the four scenario's.
  • Risk is distributed equally over the four scenario's.
Instead of allocating equal amounts of capital to each asset class, the AWP-model assigns equal buckets of risk to the distinctive asset classes. Thus "risk parity" for each quadrant is accomplished to match equal odds for the next economical and inflationary condition. AWP assumes the economy transitions randomly from regime to regime and thus the AWP needs to have one or more asset classes working well in each regime. So AWP seeks for one or more asset classes generating decent returns in each quadrant. For instance:
  • Stocks for economic expansion and low inflation.
  • Bonds for economic contraction and low inflation.
  • Commodities for economic expansion and high inflation.
  • Inflation linked bonds for economic contraction and high inflation

 
Economic contraction
 

Economic expansion
 

High
inflation

25% of risk:
- inflation linked bonds
- precious metals

25% of risk:
- stocks
- commodities
- real estate
 

Low
inflation

25% of risk
- government bonds
- inflation linked bonds
 

25% of risk:
- stocks
- real estate
- corporate bonds
 
    Table I  

How To Time The Market? Stochastics Rulez!

What if there was an indicator signaling a market turn ahead of time instead after the fact?
How about "Sell into strength and buy into weakness"?
Sounds impossible and a fools play?

Actually, applying an extra ordinary market filter is the way to go. Utilizing a stochastic crossover strategy in an unconventional setup yields a 60+% probability of a reversal signal. In a "long only" play, the win rate even jumps close to 85%. What is to follow is all about compounding and risk management.

Updated chart

Made in Switzerland: a Global Market Rotation Strategy for MDY, IEV, EEM, ILF, EPP and TLT

[Update added: See Postscript]

On Seeking Alpha Frank Grossmann published his Global Market Rotation Strategy (GMR). The goal of the GMR strategy is to achieve above average returns while avoiding big losses during market corrections. To that extent TLT is added as a "safe haven" during roaring bear markets. The GMR Strategy switches between 6 globally distributed ETF's on a monthly basis:
  • US Market (MDY- S&P MidCap 400 SPDRs)
  • Europe (IEV- iShares S&P Europe 350 Index Fund
  • Emerging Markets (EEM- iShares MSCI Emerging Markets)
  • Latin America (ILF- iShares S&P Latin America)
  • Pacific region (EPP - iShares MSCI Pacific ex-Japan)
  • US Treasury Bonds (TLT- iShares 20+ Year Treasury Bond ETF)

The algorithm of the GMR model is quite similar to Kevin McGrath's TAA model posted in Februari 2013, except that the GMR model offers the possibility to allocate assets based on weighting not only past performance, but volatility too.

"Vixenator II" or how to turn "risk" into "opportunity"

What happens when "risk" is turned into a mimetic poly-alloy? We get Vixenator II and "risk" turns into "opportunity"! While working on a risk ratio, a statistical approach towards VIX and SPX turned out to be rather promissing.

SPX weekly chart
Back in January a statistical framework was provided for DMI, MACD and RSI. For creating Vixenator II the same approach is used. For the sake of brevity please consult the mentioned posting for the theoretical background.

Bell curve of "normal distribution"
By design Vixenator (I) was limited to daily charts. For the sequel a new composition is used resulting in an indicator way more mouldable than its predecessor: because of its "liquid elements" Vixenator II allows for application on all timeframes.