Publications by Pete
Adding a volatility filter with VIX
We saw in the basic system how we could add a factor, namely the 200 day moving average, to improve the overall performance of our system. You could spend a lot of time playing with different moving averages, and different combinations of crossovers if you are so inclined, but its fairly easy to see they only work well in strongly trending market...
2567 sym 4 img
Jeff Augen Volatility Spike Code in R
[Update: I have updated this so the number of days used for standard deviation can be passed as a parameter, you can find the code at Trading Mean Reversion with Augen Spikes ]Jeff Augen has written many excellent books on options trading, including The Volatility Edge in Options Trading in which he presents a novel way of looking at a securiti...
1852 sym 2 img
Trading Mean Reversion with Augen Spikes
One of the more interesting things I have come across is the idea of looking at price changes in terms of recent standard deviation, a concept put forward by Jeff Augen. The gist is to express a close to close return as a function of the standard deviation of recent price moves. If returns were normally distributed you would expect mo...
4090 sym 4 img
Machine Learning Examples in R
This is a post that has been a long time in the making. Following on from the excellent Stanford Machine Learning Course I have made examples of the main algorithms covered in R.We have Linear RegressionFollowed by Neural NetworksAnd Support Vector MachinesOne remaining item is Logistic Regression, I am yet to find a library in R th...
1569 sym 6 img
Mebane Faber Tactical Asset Allocation in R
In 2006 Mebane Faber published a great piece of research detailing an asset allocation system that was both very easy to understand and implement, as well as carrying very respectable risk adjusted returns.The details are available in his paper A Quantitative Approach to Tactical Asset Allocation and were further expanded on in his...
2239 sym
Another cut at market randomness
I have some background in computer security and one day found myself tasked with assessing the quality of randomness for session id tokens generated by popular web frameworks (namely Java and .NET). As it turns out, NIST have developed a series of tests for just this purpose detailed here.As a non-believer in the absolute randomness of markets,...
4081 sym 4 img
Multidimensional Scaling and Company Similarity
Background and ideaOften we are looking at a particular sector, and want to get a quick overview of a group of companies relative to one another. I thought I might apply Multidimensional Scaling (MDS) to various financial ratios and see if it gave us anything useful.The premise is that companies in similar industries should all have a degree of...
2632 sym 4 img
Using apply, sapply, lapply in R
This is an introductory post about using apply, sapply and lapply, best suited for people relatively new to R or unfamiliar with these functions. There is a part 2 coming that will look at density plots with ggplot, but first I thought I would go on a tangent to give some examples of the apply family, as they come up a lot working with R.I have ...
8342 sym
Density Plot with ggplot
This is a follow on from the post Using apply sapply and lappy in R.The dataset we are using was created like so:m Three columns of 30 observations, normally distributed with means of 0, 2 and 5. We want a density plot to compare the distributions of the three columns using ggplot.First let’s give our matrix some column names:colna...
3305 sym 8 img
Tracking down errors in R
It’s that moment we all know and love, somewhere in our code something has gone wrong. We think we have done everything right, but instead of expected glory we find only terse red text lain below our lintel. This can be very frustrating, and trouble shooting these issues can often be very time consuming. All is not lost. There are a few bits ...
9770 sym