Forecast based on fixed cycles 

In this lesson you will learn how to create the simplest model based on fixed cycles. Also, in the second part, "Basic definitions", the basics of cyclical analysis will be discussed.

Fast start

So, lets start. After downloading  the price history data, click "Spectrum" button:

In seconds, you get the diagram similar to this one:

This is a periodogram, and it helps to figure out what cycles are present inside our data set as well as which ones are important and which ones are not so important. The peaks on this diagram correspond to the strongest cycles. These cycles will be used to create our model.

Let's look at one of these cycles in details. It is very simple to do: make a mouse click around one of the peaks:

The program immediately calculates the period of this cycle. In the example, the period of this cycle is 114 days. Now look at the Main screen:

This red wave shows how this 114-days cycle works in time. As you see this wave is prolonged.

Now set the amount of overtones. This parameter allows to enrich our wave. Here is the enriched 114-days wave: 

 

Let's go back to our periodogram and pick up there three other cycles (320 and 445 days cycles): 

 

 

and drag and drop these cycles into the Main screen. You immediately get the composite projection line which is based on these three cycles: 

 

 

Four steps ahead

Turbo Cycles module: Here we picked the dominant cycles manually. Sometimes a trader simply has no time for that. In this case Turbo Cycles module is recommended. This module performs all these operations automatically, providing a trader with a ready projection line that is updated automatically in real time regime when the new pieces of price history arrive. Here you will find more info about this module.

Wavelet cyclical model: this module allows to see the cyclical phenomena in dynamic, i.e. you can see how the cycles appera-live-and disappear. More information about this module you can find here: http://www.timingsolution.com/TI/7/index.htm

Committee: http://www.timingsolution.com/TS/Mini/12/index.htm

Walk Forward Analysis of cyclical models: http://www.timingsolution.com/TI/5/index.htm

 

Cyclical charting tools

We can also recommend some charting tools for visual cyclical analysis; here they are:

Harmonic Wave:

 

and Fourier String:

 

More about cyclical models available in Timing Solution can be find here.

It was the brief explanation for very busy persons. Now I will explain all details relevant to this technology.

Basic Definitions

The cycle is something that repeats itself in time. The simplest example is a workday routine: enter your office 9AM, do your duties, 1AM is a lunch-time, 4:30PM go home; same schedule day by day. Another example is a year-round cycle, annual cycle - from January 1 to December 31; same order of days, weeks and months year by year. If you talk to scientists and engineers, they will add cycles in space, not only in time; the simplest example of such a cycle is a bus route - from station A to station B, again and again. Waves - different waves - are also samples of the cycles.

We can talk about different cycles indefinitely. The most fascinating thing with the cycles is that they make possible a forecast. If we know the cycle, it is easy: find out where you are in this cycle, and you are able to tell what will happen in a minute, in an hour, next kilometer, etc. This is why the scientists love cycles. There is one more reason for this love: many cycles can be described by equations and functions. It means that (knowing a cycle, of course) we are able to program the cycle and the forecast. 

Now, I believe that you have heard enough in your life about cycles in general. In this article we will deal with the cycles that can be described by harmonic functions mostly, i.e. represented by sinus/cosine waves. This is a sample of sinus (cosine) curve:

 

    

To describe any sinus wave, you need to know: a period - the length of the cycle, amplitude - the strength of the cycle (you can see it on the diagram as the height of the sinus curve) and a phase - the angle that defines the start of the cycle (the start point on the diagram is marked as "A").

Mathematicians know many ways to play with the cycles. They have found a way to summarize several cycles at the same time. It is called superposition of the cycles; the result is a cycle as well. The resulting cycle may look like this one:

Here I did the summation of 183.1, 135.5 and 87.6 days cycles. It is displayed together with Dow Jones Industrial Index chart (a black line) and its 300-bar detrended oscillator. In regards to our main goal, making a forecast, superposition of the cycles is a very useful thing as normally we have many different cycles working at the same time.

Other interesting things that you need to know about the cycles are:

Weighting: In the previous example the same weights were used for all three cycles. Imagine that you know that one of the cycles is more important than others. You can assign to that cycle double meaning (same period, same phase, double amplitude). It leads to a different appearance of the resulting curve. Thus, playing with cycle weights we can significantly improve our superposition curve. 

Overtones: Suppose you touch the guitar string, and it starts vibrating. How many different sounds do you hear?

First of all, you will hear the main vibration of the string; on the picture above this is the upper vibration involving the whole string length. Besides, you will hear the vibration of the half of the string length; it is the next "octave" of the main sound. Also you will hear 1/3, 1/4 .. length vibrations. These "additions" to the main sound are called overtones. Some overtones sound loudly while others are very quiet; it is the reason why every musical instrument makes its unique sound.

Overtones can be used not only in music. They can add something meaningful to any cyclic process. See the difference between a pure sinus wave calculated by Timing Solution (a red one) and the same wave with the overtones - enriched wave (a green curve):

I used there 6 overtones. 

Nyquist frequency: it is named after the Swedish-American engineer Harry Nyquist; he has spent a lot of time determining the minimal time tick to be able to see a cycle. For us, it is important to remember that if we are working with daily data, it is no use to try catching the cycle lesser than two days (nyquist frequency); if we have 15 minutes data, the 30 minutes is the shortest cycle to use. Based on my practice, I would recommend using 5-7 ticks; i.e. for daily data use the cycles with a period higher than 5-7 days. I would say that Nyquist frequency is a door to a kingdom of Chaos. Keep this door locked.

Spectrogram

Try to produce different sounds in a small room. You will easily find out that some of them sound very well there, loud, you can enjoy them; while others sound very quiet, the room absorbs them. You may say that the room itself "likes" some sounds and "does not like" others. You can image the spectrogram as a result of "asking" some financial instrument how well a cycle fits to it. 

See a sample of a spectrogram created by Timing Solution". Download any financial data and click "Spectrum" button. You will get something like this:

 

This is a spectrogram. The X axis on this diagram corresponds to the period of the cycle (or a frequency of the sound in the example above), while Y is a strength of this cycle (more exactly, spectrum density). If we compare this periodogram to the sounds in the small room, the highest cycles for our financial instrument are like the loudest sounds in that room. The periodogram simplifies our life: when we have it, our task is only picking up these cycles and asking the program to cook a projection line from them.

Picking up the most important cycles

This is a very simple procedure. Just click the mouse around the peak you want to catch:

 

 

Even if you are missing the peak itself, the program automatically will catch the highest point, put this cycle into "Extracted Cycles" window and mark this cycle on the spectrogram by a vertical line.

Do this procedure several times while picking up the most important cycles:

 

You can also perform this procedure automatically: click "Extr" button and define the amount of the strongest cycles you need to extract (four cycles in this example):

 

What cycles are important?

The new "multiframe technology" developed in Timing Solution allows to make a decision regarding a cycle's significance very easily. There are 2 criteria and 2 recommendations there:

  1. choose the highest peaks;
  2. the width of a chosen peak should be as narrow as possible:

    The higher the peak, the bigger the amplitude of this cycle. The  narrower the cycle,  more energy is concentrated in this cycle. 

Recommendations:

  1. Do not use too many cycles. There are two extremes here: the usage of just one dominant cycle or the usage of hundreds of  different cycles, dominant and not quite dominant. I believe that normally 3-10 cycles define the weather on the stock market. Though these cycles change constantly change, multiframe spectrum handles this situation the best way.
  2. If you have a choice between short-term "good" cycles and long-term ones, choose the short term cycles. They carry the maximum information regarding the nearest price movement. From other side, the short term cycles can be a source of noise, so you need to try different combinations to find the best balance between the noise and the information. 

One mouse click - and the forecast is ready

If you picked up the most important cycles, click this button:

 

In the Main screen, the forecast based on chosen cycles appears:

As you have guessed already, the forecast is a weighted superposition of the chosen cycles. The program finds the weight of each cycle automatically aligning them to the previous price movement. 

To save some seconds instead of clicking the "wave" button, you may simply drag these cycles from the "Extracted Cycles" list in the Spectrum module to the Main screen:

 

To prove you that this technology is worth of your attention, see here 7 projection lines created for a randomly chosen LBC.

 

Parameters to vary

Here are the most important parameters to vary:

 

1) First of all, I would recommend to play with picking up different cycles. Use 2-10 cycles; usually this is the amount of cycles really playing some part for the financial instrument.

2) Next thing to vary is the amount of overtones. Usually I start with the pure cycle (just 1 overtone), then I increase this number. Do not use small values for "Min overtone"  parameter (see Nyquist frequency). 
Here is the projection line based on one cycle and amount of overtones is 1:

2 overtones:

6 overtones:

 

3) Also you can play with "stock market memory" parameter. The smaller value of this parameter, the more our cycles are concentrated on the most recent price data. Usually I try these numbers: 3, 7, 12.

4) You may try as well to play with the oscillator's period.

 

You can delete any chosen cycle or delete all of them using these buttons: 

 

This allows you to work with different cycle patterns and projection lines generated by these cycles. 

You can delegate the choice of cycles to the program. You will do just one mouse click on this button:. The program recalculates the spectrogram and extracts  strongest cycles automatically.

One more approach is to make a forecast using several projection lines; it is called Committee. We generate the projection lines one by one and put them into Strategy window by clicking on this button in ULE tab:

These projection lines are visible on Main Screen now. Here I put three projection lines varying the stock memory parameter:

Detrending, or what to forecast?

Mostly the financial instruments have some trends. Therefore, it is mathematically necessary to use indicators instead of the price data: our goal is to forecast as close as possible to the functions used in forecasting, i.e. sin curves. To reach this goal, we do not use the price itself to calculate the spectrum diagram. Instead, we use the detrending indicator - the relative price oscillator with the period=100 bars (as an example):

You can set this parameter manually depending on what swings you want catch. Or you can use other indicators as a forecast target - like RSI, ADX, Volatility and others.

In other words, in this particular case we perform the spectrum analysis not for Dow Jones Industrial index with its up and down trends, but for its oscillator:

This oscillator is much more convenient for the cycle analysis.

Working with intraday data

If you are working with intraday data, it is better to calculate the spectrum using price bar metric:

Thus you eliminate the effect of non trade gaps. This approach is described here. 

Scientific parallels

In this lesson I used the lexicon of the spectral analysis science. However, this technology can be expressed using different scientific accents. Let me explain it.
If you are mathematician, you will deal with the cycles from the point of view of Fourier Transform. If you are a professional in Digital Signal Processing science (DSP), you would prefer speaking in terms of filters. The spectrogram shown above can be interpret as a filter that converts "white noise" (data set that has no selective cycles) to the analyzed financial instrument. These two are practically the same math entities; only accents are made on slightly different sides.

In the following classes I will try to make the parameter (getting results)/(learning time) as high as possible.