Sunday, 20 June 2010

Update on recent efforts #4

MC testing on the slope of the repeated median straight line fit is now complete. Normalising the optimal length look back slope of a sine wave by its amplitude ( slope/(max-min)values of sine wave ) gives a ratio. A ratio distribution has a tendency to be heavy tailed (wiki/Ratio_distribution) and as quantiles are "useful measures because they are less susceptible to long-tailed distributions and outliers" I have simply used R to calculate quantiles and determined outliers to be 1.5 * IQR above and below Q3 and Q1.

By using this "new" measure of cyclic tendency the intent/hope is that prices can be said the be trending or going sideways dependent upon whether the normalised slope is outside of, or between, the levels calculated above. This idea, along with the others previously detailed, will be tested on real world data very soon. The details of this testing and a discussion of the rationale of the intended system input will be the subject of my next posting.

Saturday, 19 June 2010

Update on recent efforts #3


In my last post I spoke about conducting a Monte Carlo test to determine a maximum and minimum slope value for the repeated median straight line fit, the purpose being to establish levels outside of which it could be said that price is unlikely to be moving sideways according to the modelling of prices as a sine wave. A plot of the first step in this procedure is shown above.

The plot shows the MC test output of the slope of the repeated median straight line fit at various multiples of the period of the sine wave model. At 6 on the x-axis, representing a particular multiple, it can be seen that the standard deviation of the test run output is at a minimum, meaning this is the value that sees the least variation between MC runs, and the mean and median of the output at this point is the expected value of zero. This exact pattern repeats for all periods of interest (10 to 50 inclusive). This result is gratifying in that the actual value of the look back period multiplier seems to make sense theoretically, and the fact that it is the same across all periods means that it is a robust parameter. However, because the standard deviation is not zero, the next MC test will be to determine the normalised upper and lower levels already mentioned, using the optimised look back period multiplier represented above.

Sunday, 13 June 2010

Update on recent efforts #2

I have been working on my new idea for the past week or so and I have finally managed to get a compiled .oct function which works, although it is not optimised for speed. Above is a plot of this, which shows two sine waves with their respective repeated median straight line fits. Both sine waves are one complete cycle, have the same period and amplitude, and only differ in their phase. As can be seen the straight line fits display different slopes, so the next thing I'm going to do is a Monte Carlo test to determine upper and lower values for the slopes at different periods, normalised to the amplitudes. The point of this to determine levels of normalised slope above and below which it can be said that price is not likely to be moving sideways. Conceptually, this could be thought of as a switch between trending and non-trending market environments.

Sunday, 6 June 2010

Update on recent efforts

In my last post I spoke about a new idea that I want to code. Well, I have been working on this and the coding has turned out to be frustratingly difficult and I am having to rely on the generosity of forum members (Nabble-Octave-General) to help me. However, I'm sure that eventually it will be successfully coded.

What I'm trying to code (as a dynamically loaded C++ Oct file function) is an adaptive, moving window, repeated median, straight line fit, the inspiration for which I got from Meyers Analytics and the system on this site which is called the Robust Repeated Median Velocity System. I don't intend to use this system as such, but I have an intended use for the idea of a statistically robust, straight line fit. More on this in due course.

Sunday, 30 May 2010

Timing short term market turns

The top plot above shows the sine wave modelled prices in white, with the Cybercycle indicator plotted in Cyan and blue. The bottom plot shows an indicator I have created to time the turns in the original, white series based upon the Cybercycle.

The basic theory behind the projected use of this indicator is simple: extract the cyclic component of price using the Cybercycle, measure the period of the cycle, and when the Cybercycle crosses its zeroline it can be anticipated that in one quarter period's time the turn will occur. This anticipated turning point is indicated when the white sawtooth line (the time elapsed since the last Cybercycle zeroline cross) reaches the three horizontal green lines (2 days before, 1 day before and the actual "turn" day counted out from the last Cybercycle zeroline cross). The white sawtooth is reset to zero each time a Cybercycle zeroline cross occurs (shown by the red lines). This indicator has been optimised using MC techniques to account for the lead/lag at different periods of the Cybercycle compared to the original input price series.

This new indicator, combined with the previously described Tukey Chart, will provide decision making input to the final system. Projected uses might be something like:
  • if a Cybercycle zeroline cross occurs whilst prices are within the Tukey upper and lower contol limits, can anticipate a short term market turn in 1/4 period's time
  • if prices reach either Tukey control limit at the same time the sawtooth reaches the green lines, a signal is given to take profits, take a new position etc.
These ideas will be tested on market data, along with the Tukey Charts, in due course. However for the moment I now want to work on a new idea which, if I can successfully code it, I believe will complement the above.

Wednesday, 26 May 2010

Monte Carlo Optimisation of Control Limits Complete



The MC optimisation of the various ucl and lcl multipliers is now complete and the "finished product" is displayed above on the same data as in the plot of post dated 16th May 2010. Simple visual comparison of the plots shows that recent adjustments to the MC methodology of selecting the ucl and lcl multipliers makes very little difference, except in the case of the lower plot of the Fisher Transformation of the Cybercycle indicator. This tells me that further work on more MC optimisation of this would probably be a waste of time, so I now consider this optimisation work to be complete.

The idea of applying control chart theory directly to market prices and derived indicators now needs to be tested on historical market data.

Monday, 24 May 2010

Monte Carlo Optimisation of Control Limits #9

The above is the optimisation of the cybercycle ucl and lcl, adjusted so that the control lines can be plotted on price bars, i.e. the yellow lines in the plot posted on 16th may below. The green and light blue boundary lines are polynomial line fits, which will be the actual multipliers used. This plot is somewhat different to that in the post of 5th May (Monte Carlo Optimisation of Control Limits #4). I put this down to the fact that at longer periods the cybercycle tends to lead prices and so the peaks/troughs in the cybercycle do not occur at the same time as those in the underlying data. The result is the upward sloping fit seen above.