"Trading is statistics and time series analysis." This blog details my progress in developing a systematic trading system for use on the futures and forex markets, with discussion of the various indicators and other inputs used in the creation of the system. Also discussed are some of the issues/problems encountered during this development process. Within the blog posts there are links to other web pages that are/have been useful to me.
Pages
▼
Saturday, 17 July 2010
The Dedicated Dekalog Website
I have just created a website dedicated to the Dekalog trading approach HERE. It is my intention in future to upload results of tests etc. of the Dekalog system to this new website. However, I will continue blogging here and refer readers to the Dekalog site whenever appropriate.
Wednesday, 14 July 2010
Addition to title header bar
I have just read an interesting blog post about the source of trend following returns (price-distributions-trend-following) and one of the comments on this blog post includes this - "Trading is statistics and time series analysis. I’m amazed how many 'trading books' fail to cover these relevant topics." I like this so much that I thought I would adopt this as a motto for the Dekalog approach and I have included it in this blog's header bar. I think this neatly sums up the Dekalog approach, which applies the precepts of robust statistics directly to price and derived indicators.
Monday, 5 July 2010
Discussion of work so far
In this discussion I will be talking about the indicators etc. that have been developed so far and the reader is referred to all previous posts and especially the candlestick chart in the post dated 3rd July and the version thereof above. The topmost plot above is the same as the topmost in the previous post, whilst the lower plot is a plot of the default coloured bars only (see post dated 3rd July).
Looking at the extreme left of this candlestick chart we can see that a cybercycle zero line cross has just occurred (@ x-axis 3720) and at x-3724 the candles change colour to cyan, meaning that the turn indicator shows a possible turn in 2 days time. A few days later, candles turn yellow, meaning that prices are still in the "turn window" but no longer satisfy the conditions for being a sideways market according the formula for momentum/abs(ucl-lcl) of cybercycle. At this time, the momentum indicators are following the pattern that can be expected for a cyclic top to be in place. All in all, I would characterise this as a high probability short set up and subsequent price action confirms this to be a good call as prices decrease to the price lcl levels (@ x-3738).
At these new lower levels (@ x-3738) we now see a new set up to go long. Again prices are indicated to be in a "turn window" and the momentum indicators are following the pattern that can be expected for a cyclic low to be in place. Again this turns out to have been a good call as prices subsequently increase to the price ucl levels (@ x-3747).
As prices reach these new high levels (@ x-3747) there is again a change to cyan bars indicating another cyclic turn is imminent, this being confirmed by the momentum indicators patterns. However, subsequent price action obviously fails the assumed cyclic model as prices move into a narrow sideways channel with both the cybercycle amplitude decreasing and the cybercycle flip-flopping around the zero line. Also the expected cyclic pattern of the momentum indicators breaks down with all three period lines converging to, or flip-flopping around the zero line. There is an interesting series of posts on Brett Steenbarger's blog about approaching trading in a scientific manner, with a trading hypothesis being either confirmed (profitable trade) or being disconfirmed (unprofitable trade) and thus providing new market insight. Taking this approach, the failure of the turn indicated at x-3747 (and possible trading loss) provides new market insight i.e. trying to trade cyclic market turns isn't going to be profitable, even though the prices are indicated by the predominantly green and cyan bars to be moving sideways. If the market is trading sideways but it isn't profitable to pick highs and lows to take advantage of mean reversion, may be it will be more profitable to trade breakouts of the sideways channel?
So, the question now is how to trade the breakout, and in which direction? The momentum indicators perhaps give a clue. All the default colour bars, apart from 4, are blue, indicating upwards momentum. Also, the full period momentum never goes negative throughout this sideways channel. I would take this as a strong indication to look for an upwards breakout, which in fact occurs at (@ x-3774). The market then runs upwards for approx. 2 weeks. During this time period trailing a stop would seem to be the most appropriate approach as there are no cyclic or sideways market indications i.e. no green or cyan coloured bars.
This 2 week upward run ends at x-3792 with a sharp red down bar. If not already stopped out, and in the absence of either green or cyan bars, and with all three period momentum lines indicating either falling or negative momentum, this would appear to be a straight forward, go with the flow, short signal. If taken, short profits accrue quite quickly until the third cyan bar (@ x-3798) when there is a bullish engulfing bar followed by a short retracement of the down move. The indicated "turn window" immediately prior to this short retracement might indicate a new long position is in order, or perhaps only take short profits. However, militating against this action is the fact that both prices and the cybercycle have penetrated below their respective lcl levels. It is difficult to say whether, in reality, either action would have been taken if a short position had been established. However, it is easy to say that the hypothesis of a cycling market is quickly disconfirmed by the sharp downward bar at x-3802, which closes below the low of a possibly perceived, cyan bar, cyclic low, and which is immediately followed by a "hammer" candlestick pattern and then 4 red bars. Whether the 4 red bars would indicate a new short would be debatable as 2 of the momentum indicators at this point show bullish divergence.
After these 4 red bars we get 3 blue bars, which following bullish divergence and a hammer signal would indicate a new long is in order. Additionally the full period momentum indicator is flattening out, which would indicate possible high momentum to the upside if the bars were actually green and hence possibly cycling. If taken, this long moves into profit until we get green and cyan bars at the price ucl level at (@ x-3815), which of course indicates that a possible cyclic top is imminent. However, this hypothesis of cycling behaviour again is quickly disconfirmed by prices moving higher, the presence of another hammer, the momentum indicators not following the "expected" pattern for a cyclic top and finally the bars turning blue for a nice set up for the long up trend to the red bar (@ x-3858).
Of course, the period starting with the red bar (@ x-3858) is very interesting as it incorporates the record breaking, huge, intra day move and subsequent large oscillatory swings and increased volatility. Given these unique conditions I think it would be too much to expect any systematic approach to behave "normally," and equally I think it would be unproductive to try to adjust the system parameters to cope with such conditions as this would be gross over fitting of system parameters. However, having said that, how might the current implementation the "Dekalog" system have coped?
Well, the fact that there is a red bar 8 days before the meltdown means that any open trades would probably have been short trades, hence benefiting from the big move. In fact the day of the big move is the first green bar for approx. 40 trading days, and hence no cyclic action inspired trades would have been open on the day of this move. Given that no "cyclic" trades would have been open, the default trade direction of short (red bars) was in place for 4 consecutive days before the big move to the downside. After the big move the bars are green for 9 more days before turning red again, indicating possible sideways/cyclic market conditions. Would cyclic trades have been placed during this period? Well, who knows? The "Dekalog" system rules have not been tested enough and are not yet refined enough to say for sure what cyclic positions if any, would have been taken. Certainly, after such a big move in one's favour it might have been psychologically difficult to take a contrary position. Also, during the first part of this 9 day period both prices and the cybercycle were below their respective lcl levels, suggesting that it might not be time to try to trade any cycles.
After this 9 day, possibly cycle period, there is again a period of default bar colours, but with obviously higher volatility than normal. If trading had occurred during this period a couple of whipsaw losses might have been realised. However, at bar (@ x-3890) the bars turn green again for a probable small, long side profit, quickly followed by an almost perfectly indicated cyclic high which results in a nice profitable short trade down to and through the price lcl level. The last, yellow bar is the daily price bar for 2nd July.
All of the above should be read in the spirit of "me thinking out aloud" about how the Dekalog approach should be applied, and does not represent hard and fast, tested system rules. The testing and systematic application of these concepts to different price series will be the focus of immediate future work, and in this regard some ideas that come to mind are listed below.
- The default bars look back period is available for optimsation as a stand alone momentum/trend following system to act as a benchmark for all other incarnations of the Dekalog system. This "Default Bars" system itself is to be benchmarked against other common "systems."
- The above "me thinking out aloud" is, of course, very subjective and could be forward tested in real time using my Collective2 account. This will also act as a period of observation of the behaviour of the "Dekalog" approach and enable me to get a sense of how it performs and to develop trading rules. This will also require speed optimisation of current Octave implementation of ideas for practicality.
- Some methodology to distinguish between sideways markets suitable for cyclic top and bottom picking and those best suited to a breakout only methodology needs to be developed.
Saturday, 3 July 2010
Update on recent efforts #5
I have spent the last week or so working on and refining my ideas connected with the use of the repeated median. The first thing is that the formula from the earlier post has been altered to (repeated median slope*period length)/(max-min)values of sine wave. In effect this then becomes a form of normalised momentum indicator. MC testing has been done such that I now have upper and lower limits for this at each period of interest; i.e. if the momentum across the measured period is outside of these limits, prices are highly likely to be trending and not cycling sideways. In actual application to price, the (max-min)values of sine wave in the above formula will be replaced by the absolute difference between the ucl and lcl of the cybercycle, the theoretical MC optimised limits of the extracted cyclic component of price.
An additional benefit to the repeated median slope*period length change is that I now have a form of normalised momentum indicator and the first plot above shows three applications of this to a sine wave, the three look back periods being a full cycle period (green), a half period (red) and a third period (light blue). The point of plotting this is to see how this indicator behaves in ideal cyclic circumstances to help formulate rules for use on real prices.
This indicator has the interesting properties listed below
Firstly, the lowest sub plot is the normalised momentum indicator described above. The full period momentum line is coloured blue or red depending on whether the momentum is positive or negative, the half period momentum is coloured light blue and the third period momentum is the yellow line.
Above this there is the short term, market turn, timing chart as described in my earlier post dated 30th May. A slight addition to this is the red half period line and the fact that if the count line is above this, it is also coloured red. The interpretation of this particular chart is that red means a cyclic zero cross is "overdue" and is an indication that cyclic behaviour, if present, may be breaking down.
The third, uppermost sub plot is the yellow cybercycle and its MC optimised ucl and lcl lines. The cybercycle line is coloured red when the timing chart indicates that a market turn is due (plus and minus 2 days around the quarter period count from the most recent zero line cross).
Finally, the topmost plot is the price candlestick chart, each bar separately colour coded according to the indicators so far mentioned. Bars are green if the full period, repeated median price momentum, normalised by the absolute difference of the cybercycle ucl and lcl is within its MC optimised limits. The bars that are yellow or cyan correspond to the timing turning points, similar to the red on the cybercycle plot, the difference being that the cyan bars also meet the condition for being green bars; this is to be interpreted as a strong indication that a market turn is imminent. By default if none of the above conditions are met then bars are blue if the third period repeated median momentum is positive or red if negative. The "bands" around the candlesticks are the full period ucl and lcl for the typical price (H+L+C)/3 and the same separately for the highs and lows, which are to be interpreted as support and resistance levels when prices are determined to be cycling or moving sideways.
I think the value of the approach taken so far, and the understanding of market action that can be inferred, is evident from this plot, but a more detailed discussion of this will be the subject of my next post.
An additional benefit to the repeated median slope*period length change is that I now have a form of normalised momentum indicator and the first plot above shows three applications of this to a sine wave, the three look back periods being a full cycle period (green), a half period (red) and a third period (light blue). The point of plotting this is to see how this indicator behaves in ideal cyclic circumstances to help formulate rules for use on real prices.
This indicator has the interesting properties listed below
- the third period line turns up/down almost exactly at the peak and crosses the half period line prior to this as an early warning signal of an impending turn.
- the half period line flattens out over the peaks and crosses the zero line at the same time the sine wave crosses the zero line.
- the full period line crosses the zero line as the sine wave peaks and flattens out over the section of the sine wave that actually has greatest directional movement, which is understandable given the nature of the calculation of the indicator.
Firstly, the lowest sub plot is the normalised momentum indicator described above. The full period momentum line is coloured blue or red depending on whether the momentum is positive or negative, the half period momentum is coloured light blue and the third period momentum is the yellow line.
Above this there is the short term, market turn, timing chart as described in my earlier post dated 30th May. A slight addition to this is the red half period line and the fact that if the count line is above this, it is also coloured red. The interpretation of this particular chart is that red means a cyclic zero cross is "overdue" and is an indication that cyclic behaviour, if present, may be breaking down.
The third, uppermost sub plot is the yellow cybercycle and its MC optimised ucl and lcl lines. The cybercycle line is coloured red when the timing chart indicates that a market turn is due (plus and minus 2 days around the quarter period count from the most recent zero line cross).
Finally, the topmost plot is the price candlestick chart, each bar separately colour coded according to the indicators so far mentioned. Bars are green if the full period, repeated median price momentum, normalised by the absolute difference of the cybercycle ucl and lcl is within its MC optimised limits. The bars that are yellow or cyan correspond to the timing turning points, similar to the red on the cybercycle plot, the difference being that the cyan bars also meet the condition for being green bars; this is to be interpreted as a strong indication that a market turn is imminent. By default if none of the above conditions are met then bars are blue if the third period repeated median momentum is positive or red if negative. The "bands" around the candlesticks are the full period ucl and lcl for the typical price (H+L+C)/3 and the same separately for the highs and lows, which are to be interpreted as support and resistance levels when prices are determined to be cycling or moving sideways.
I think the value of the approach taken so far, and the understanding of market action that can be inferred, is evident from this plot, but a more detailed discussion of this will be the subject of my next post.