Wednesday 21 April 2010

Applying Control Charts to price series


For my first substantive post I thought I would post a screenshot (http://www.gnuplot.info) of what I'm currently working on. The red line is a sine wave and the lines of interest are the yellow upper control line (ucl) and the blue lower control line (lcl). For a description of what the ucl and lcl are see http://gunston.gmu.edu/708/frTukey.asp

The basic idea is to apply the concept of a Tukey Control Chart to prices to determine whether prices are moving sideways or not. To that end, the above sine wave models a sideways moving market and represents the pre-intervention period for constructing the ucl and lcl. The idea is that if prices are outside either of the control limits then prices are NOT moving sideways in a cyclic fashion and by default must be either trending up or down. This in turn will determine what trading approach to take given current market conditions and what indicators to use.

The above ucl and lcl do not use Tukey's recommended 1.5 multiplier for the Fourth Spread but instead use a different multiplier depending on the period of the sine wave. This has been determined simply by looking at numerous charts and adjusting the multiplier so that the control lines are as close as possible, visually, to the peaks and troughs of the sine wave. Future work to be done is to write a program/routine - I use Octave (http://www.gnu.org/software/octave) and C++ functions written for Octave, and occasionally the statistical software R (http://www.r-project.org) in my development work - to optimise this multiplier for each period length. For help in coding this I have posted on the Octave Nabble forum and I am waiting for any responses. The hope/expectation is that on a real price chart the ucl and lcl will indicate support and resistance areas when prices are in a sideways moving channel as well as indicating the fact that current price is actually moving in a fashion that, statistically speaking, is indistinguishable from a sideways moving channel.

No comments: