Systematic Trading research and development, with a flavour of Trend Following
Au.Tra.Sy blog – Automated trading System header image 2

Trend Following Wizard Correlations Heatmap [Video]

March 10th, 2011 · No Comments · Data, Trend Following Wizards

One of my favourite non-trading-related blogs is FlowingData, a visualization and statistics site by Nathan Yau.

I find Data visualization fascinating and inspiring. A good visualization usually “brings data to life” making it easier to understand. Most visualizations featured on FlowingData are very aesthetically pleasing, making the subject a sort of enjoyable and useful “geeky art”. The Correlations Heatmap video below is an attempt at some of this.

Trend Following Wizard Correlations Visualization: Video of Evolution through time

For this post, I got inspired by a reader comment mentioning that it would be interesting to calculate correlations between the Trend Following Wizards reported on the blog.

I agreed with the idea, and seeing this tutorial post on creating heatmaps in R on FlowingData (with sample code: thanks!) gave me the idea of a data visualization of my own: showing the evolution of correlations through a “time-lapse” video of monthly correlation heatmaps through time. Fun and quick little project dealing with trading-related data, visualization and programming. Perfect combination!

The resulting movie is embedded below (available directly on the vimeo website in slightly larger size):

With the color key:

Every month, a rolling 12-month correlation number is calculated (using Pearson) between each Wizard, The full matrix of pairwise correlations is then represented in a heatmap format, with the cell color, directly representing the correlation coefficient, as per the color key above.

The movie simply stitches all heatmaps in chronological order, month after month, from January 1990.

You’ll notice that some cells are grey: light grey means that I do not have any available data for that month for the corresponding Wizard. Dark grey is to hide the correlation between a Wizard and itself (irrelevant as obviously always equal to 1).

It is interesting to see how the heatmap moves from periods of strong correlation (near all-blue, check the Summer of 2003 for example) to more heterogeneous periods.

I was also intrigued by some periods showing real jumps for the whole heatmap (check July 99 to August 99). It is not so surprising though, when you know how data outliers can have a strong influence on the (Pearson) correlation numbers (this is what happens in the jump from July to August in 1999: August 1998 showed strong returns for most Wizards; when these numbers drop off the correlation calculation, the correlation coefficients sharply decrease as a result).

Software note: The movie was created using R to generate the heatmaps (as per FlowingData heatmap tutorial) and XnView + FFmpeg to edit and stitch images into a video.

More Data Visualizations

FlowingData publishes very regularly and the quality is usually very good (Nathan Yau’s book is definitely on my Wish List).
For readers interested in checking it out (watch out, you can quickly spend an hour on the site!), here are some posts or links that caught my attention:


In investing, timing is everything (we know that!): This one is directly related to investing/trading, and I believe Trend Following Wizard CTAs could use the idea to present their past results to prospective investors in a similar fashion. This is a grid diagram which shows annualized returns for the S.& P. 500 for every starting year and every ending year since 1920 – nearly 4,000 combinations in all:

Originally from the NY Times, link to full original diagram

CTAs could plot their monthly returns to get an overall view of what an investor could have made at different periods and highlight specific stats like 36-month, 60-month rolling returns. Possibly another similar chart with drawdowns to complete the picture. This could be an interesting project.

Past century of government and economy: Displays several economic indicators over 100 years, aligned with political parties in power.


For sport stats lovers:


Facebook worldwide friendships mapped:

Commercial Air Traffic Seen Around the World (video):

Watching the Growth of Walmart Across America (video):

Our changing world in cartograms:

Series of videos showing the evolution of several indicators per country, morphing the size of countries proportionally to its indicator value. Some surprising world map redrawing!


10 Best Data Visualization Projects of the Year – 2010:

What New Yorkers complain about:

Fancy drinks recipes infographics:

And finally, an interesting one hour documentary video on “The Joy of Stats” by Hans Rosling


Related Posts with Thumbnails

Tags: ··

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment