Friday, December 30, 2011

Why Cycles Aren't That Easy

It's easy to understand why one might think cycles are easy to figure out.  Let's take a simple sine wave and call it Figure 1.

Fig. 1:  Sinusoidal wave with wavelength 100 units, amplitude 10.

Actually, the equation used here (and for subsequent figures) was negative cosine, rather than sine, because I wanted the cycle to be at a bottom at timestamp 0.  This cycle behaves as any such sinusoidal wave should:  it bottoms at 0, 100, 200, 300 etc. at a value of -10, reaches its top at 50, 150, 250, 350, etc. at a value of +10, and passes through zero at 25, 75, 125, 175, etc.

Now let's suppose I add a 50-year cycle, with the same amplitude and with its phase set so that its bottom is also at timestamp 0:

Fig. 2:  50-unit and 100-unit cycles combined
Now, at timestamp 0, the value of the "market" (if this is to represent the stock market) is -20.  The 100-unit and 50-unit cycles, both at their respective bottoms, exhibit constructive interference and so our "market" is down much further.  The subsequent top actually occurs a little later than timestamp 25 as would be expected, because while the 50-unit cycle is going down, the 100-unit cycle is still rising.  The same effect occurs in reverse at about timestamp 70, resulting in an earlier peak than expected (while the 50-unit is still rising, the 100-unit is falling).  At timestamp 50, the 100-unit cycle is at a top, while the 50-unit cycle is at a bottom - we get destructive interference and a "market" value of zero (+10-10).

Now, for fun and to illustrate how tricky cycles can become even when there are just a handful, I combine cycles of 100, 64, 36, 16, and 9 units.  They are all of the same amplitude (10) and are all in phase at time unit 0.

Fig. 3:  Several cycles, all in phase, all same amplitude.
Okay.  You can, for the most part, see what's going on.  Obviously at timestamp 0 they all undergo constructive intereference with each other and the "market's" value is -50.  The prominent "triple top" observed by the market has its highs at about timestamps 22, 40, and 58 - these highs, in fact, are 9-unit cycle highs that occur, for the most part, during the "high" phases of the 100- and 64-unit cycles.  Similarly, the high in timestamp upper 80s can be attributed to the juxtaposition of the 64-unit and 16-unit cycles approaching peak and the 9-unit and 36-unit ones just past it.

But would you have been able to figure those cycles out if I hadn't already told you what they were, and if so, how long would it have taken?

Now let's make things more complicated by putting the cycles out of phase at timestamp 0.

Fig. 4:  Like figure 3, but cycles out of phase.

 In this instance I have helpfully included the magnitude of the phase shifts.  Notice how the graph has changed compared to Figure 3 - there's no true "triple top" anymore.  Now, what happens if I mess with the cycles' amplitudes, and add a secular "bullish" linear trend y=0.25*t, where t is the timestamp?

Fig. 5:  As graph title implies.
Notice how suspiciously like a continuation head and shoulders pattern this looks like.  There is a strong "bull" move up in timestamp 35-40 where, if this were a market, fortunes could easily be made on the long side (depending on what the actual market values of this would be).  Similarly, after an extensive topping process including a "bull trap" from about timestamp 53-67, there is an equally powerful "bear" move down from positive 36 or thereabouts to about negative 11.

Now, to further complicate things, let's add some noise.  Using Random.org, I generate for each time stamp a uniformly distributed random number between -15 and +15, and add it to the cycles.  I do this with four different sets of random numbers, which you can consider to refer to different market indices.  These random numbers are supposed to represent smaller variations in the market.  Take their cause how you will - smaller-scale cycles, earnings reports, fundamentals, the psychology of the collective investors, the whims of central bankers, etc.

Fig. 6:  As graph titles imply.
Clearly the prominent larger trends remain intact--there is a strong "bull" move, for instance, at timestamps in the late 30s and a strong "bear" move in the late 50s/early 60s.  But they don't equate--there is significant non-confirmation, for instance, in index I (which peaks at timestamp ~55) relative to indices II, III, and IV (which peak at timestamp ~40).

Obviously, you'd need to use a smoothing algorithm to determine the time cycles from this; the questions, of course, are (1) would you get the right period for the cycles?  (2) would you be able to tell which are of the greatest magnitude?  (3) would your smoothing algorithm catch cycles that aren't there (or ignore cycles that are)?  And it might create more problems if the "noise" is patterned (e.g. Elliott waves) rather than purely random.

Now take into account that I have:
  • assumed that the cycles are all sinusoidal in nature
  • assumed that the amplitude, phase, and wavelength of each separate cycle are all constant
These assumptions may, in fact, not be valid.

1 comment:

  1. Your patience is impressive. Reading discussions you've had on this topic elsewhere, were I in your position, I'd have long jammed sharp objects into my ears in response to what others were claiming.

    ReplyDelete