Algo Trading – The Portfolio

Feb 19, 2019 Update <<<

Since EU regulations for trading in US ETF’s have made it impossible to follow this algo – I’ve made some modifications. From now in trading is only done in forex, futures and options (actually options on US ETF’s are still allowed) Therefor the model is now reduced to these instruments. This does of course limit the potential somewhat, especially in bull stock markets. On the other hand the algo is now completely symmetrical.

>>> Update End

Dec 20, 2016 Update <<<

I’ve added a SP500 long only stock model to the portfolio since the correlation to the other models is low. The model usually has 7 positions with an average holding time of three weeks, buying on strength. The model has been used for some time in other systems I’ve used and performed well in current environment.

The total number of included models at this time is five. Three symmetrical ETF based, one long only ETF based and one long only SP500 based. Risk is distributed equally between the models.

>>> Update End

Below is a simple example of a four model system having three (or less) positions each. The model is trading ETFs covering more or less all parts of the world and asset classes. Three of the models are symmetrical, ie. they are as likely to take long as short positions in any instrument. One of the models is long only and only takes positions in the stocks through sector and geographical ETF’s (no individual stocks).

As you can see, designing a profitable systems is not that difficult. I learned, by trial and error, that the hardest part is to execute the system consistantly and handle drawdowns and losses. Since I do not like daytrading and/or constant monitoring, I settled for the week to month timeframe.

I also realized that there are no really good systems for simulating complete portfolio strategies in a flexible manner. So I built one myself using end-of-day data from Yahoo Finance on a Linux/perl/MySql/MongoDB platform.

My conclusion is that using portfolio level models that make descisions based on relative movements between instruments clearly outperforms models based only on price of the individual instruments.


To be able to trade these instruments you need a broker of some sort and an account that allows you to either short or buy put options in the ETF instruments. Personally I use Thinkorswim and sometimes use futures and most of the time forex (currency) instead of the ETF due to better price and liquidity. In the US there are a lot of others brokers available of course. Pick your choice…

An easy choice in Sweden (and many other markets) is IG Markets or, as I recently discovered, Interactive Brokers, that give you the possibility to trade as suggested. I don’t know about their pricing though.

It is a bit complex to calculate the position size when using futures, forex and especially options. For example if the suggestion is -1464 FXY at $84,84, this means you are actually selling (short position) Japanese Yen for a total of $124,206.- with a hope to buy them back later at a cheaper price. On the forex market this translates to a 12 contract ($10,000 each) long position in the USD/JPY currency pair to get (almost) the same position.


The basic portfolio system has the following main characteristics:

  1. Always 3 positions with equal risk in relation to 14d ATR (ATR=Average True Range). As long as 3 instruments meets all the criterias of course.
  2. Filtering on 26day SMA > 104day SMA for long positions or vice versa for short. (SMA=Simple Moving Average)
  3. Ranking on the distance between latest close and the 26d SMA in relation to 14d ATR to normalize risk between positions.
  4. Portfolio level filtering on correlation between positions and on the sum of the correlation matrix (ie. the portfolio will never have 3 highly correlated positions). If the best ranked ETF is too correlated, take the next one, etc.
  5. Gains are realized and losses are covered on a daily basis.
  6. Positions are entered and closed at the opening price.
  7. Exit position when ranking according to (3) has dropped a certain number of “ranking positions” in relation to where it was when entering, or when (2) is no longer valid.
  8. Goto (2).

In the example below I use this model with different parameters for entry, exit and correlations to achieve varying timeframes and low corellation between the models. As I wrote above, one of the models is only stocks and long only.

The aggregated model below is optimized for a portfolio of approximately $100k with a daily VaR avarage of 1.9% (95% confidence interval). Note, that due to fat tails the probability of larger moves is more common than this suggests.

This is what it looks like today! The model has been backtestad from 2000 and traded live since early 2011 (5 years now), more or less unchanged. During this live period it has returned ~15-20% annually so it is not fictional …



Heatmap and bubble chart below shows the instruments traded by the Sifferkoll Algo. Heatmap is showin strength as size and latest day change as color. Bubble chart shows Momentum as X, volatility change as Y, trend as size an flow as color.


Disclaimer: As you obviously understand this is in no way investment advise, only a description of what I have done.


5 thoughts on “Algo Trading – The Portfolio

  1. Pingback: Financial Markets in a Low #OILPRICE #LENR World! | Sifferkoll®

Leave a Reply

Your email address will not be published. Required fields are marked *