Sunday, 25 April 2010

Monte Carlo Optimisation of Control Limits #1



The overnight run went without a hitch and I now have a text file of 3000 rows (the number of iterations in the MC routine) and columns for the ucl and lcl multipliers for sine waves of periods 10 to 50 inclusive.

As a first simple analysis of these I have used the simple R commands boxplot(ucl) and plot(density(ucl)) to plot graphs for quick visual examination of the distribution of these multipliers, each graph being either ucl or lcl for one sine wave period only. A generic example of boxplot(ucl) is the first graph above (this happens to be ucl for sine wave period 20). As can be seen, there are no outliers beyond the whiskers and it would appear that the distribution is evenly spread about the thick median line.

The second graph is plot(density(ucl)), a plot of the kernal density. Note the steep drop offs at about 2.00 and 2.15. This is a pattern that repeats for almost all periods for both the ucl and lcl, although of course with different values at the drop off points. This second graph suggests that in fact two multipliers could be used to create a "zone" ucl and lcl. It can be conjectured that
  • if prices are outside this zone, either to the upside of the ucl zone or downside of the lcl zone, there would be a high probability that in fact prices are trending,
  • whilst if prices are between the zones they could be considered to be in a sideways channel
  • whilst if prices are actually between the lines that create either zone they could be considered to be in a high probability area for a price reversal in a sideways market, or alternatively in a zone where a breakout from a sideways market is imminent.
However, before this particular idea is investigated further there is one more run of the MC routine I would like to do. The above results come from a run where the sine wave amplitude is one. Of course real prices, if they are in a sideways channel, won't be oscillating with this amplitude but will have variable amplitudes. Therefore the MC routine shall be run again with sine waves of various amplitudes, and the results compared with those obtained so far.

No comments: