Wavelets: a second breath for models based on fixed cycles
description of the upgrade July 27, 2005 (with August 2, 2005 addition)
written by Sergey Tarassov
Understanding the core idea of wavelets' usage
The first 6 months of Timing Solution program's existence (January, 2005) show that users apply the great variety of techniques to get the projection line. Sometimes their approach is totally unexpected for developers. And it is good, because the main goal of Timing Solution is creating a universal platform for any forecast based on any type of models. If there is anything that might be predicted, we can create the projection line for it!
The technique discussed further was born in conversations with one of our supporters in Russia, Mr. Vlad . We have had to add just a few new features to the Timing Solution software to make the usage of this technique more user friendly.
What is the main idea of this technique? Let us look back. We used to work with models based on fixed cycles (i.e., cycles that repeat themselves with the same time period). The standard approach is calculating the spectrum for analyzed price history data. It is a very good technique, it gives us the information on majority of the cycles working for the analyzed data. Look at this example; this is the spectrum calculated for the price of Ford Motors Corporation shares (to be exact, for its detrended oscillator); we use the data from 1977 to 2000:
Peaks of this diagram represent the most influential cycles for this company's shares. We have chosen only four major cycles: annual (one year) cycle, 303 days cycle, 3.2 years cycle and 4.9 years cycle. There are more cycles that may play some part for this stock, but these four are the most powerful. Using Timing Solution software, you can get the projection line based on these cycles by just one mouse click.
The bad news is that the stock market is rather fretful and does not like following any laws/rules all the time (though it has to do so for shorter periods). Usually, it looks like the stock market follows some cycle, then "something" occurs, and the stock market "forgets" about this cycle and starts following another one. We can say that the market has its favorites among cycles (we do not discuss a possible reason here) and from time to time it trades one favorite cycle to another. The spectrogram (i.e., spectrum) shows us the "force" of these favorites. Sometimes the market looks like it becomes crazy and changes favorite cycles every day; its behavior becomes unpredictable (it is quite probable that Random Walk Theory was born at one of those moments:)). It is good for a trader when the market follows one of its favorites (cycles); it is not that good when the market is changing them.
It is a poetical picture, now let us dress it in the clothes of the techniques available in Timing Solution software. In brief, the main question is: how to find out when the cycles' change take place and what might be the next favorite?
Start with the spectrum window. Extract the cycles that work for this market; they will be listed in the bottom part of the window. When you choose any cycle from the list, the program calculates its "cycles activity diagram" (in our example, it is 303 days cycle):
The red zones represent the periods when the stock market follows this 303 days cycle (this 303 days cycle is in favor). Opposingly, the blue zones represent the periods when the stock market does not "like" this 303 days cycle and prefers to go for another cycle/cycles. You can take this diagram as a stock market's mood picture in respect to 303 days cycle. As you see, this mood is very changeable.
The changeable character of the stock market behavior is the reason of difficulties in modeling a good projection line, we simply have no permanent factors here that move the stock market, it strongly depends on the stock market's mood in respect to the chosen cycle. IMHO, understanding the nature of the stock market's mood contains the keys to improve the forecast's performance significantly. Right now, two technologies are developing to handle this situation: one of them is presented in this article (it is an application of the wavelet analysis). Another one is so called "multiframe technology" that will be released this fall. Both approaches are developing under the frame of Timing Solution software.
Let us demonstrate how to create a projection line taking into account the cycles that are related to the "mood" of the market. Suppose we are analyzing 303 days cycle. Click on this button:
You will get one more spectrum diagram, but this spectrum is calculated for "cycles activity diagram"; it shows the mood of the chosen stock market in respect to this 303 days cycle:
You can pick up any cycle clicking the mouse around the corresponding peak. The most strong cycle here is 3.5 years. In other words, we can tell that, with the average periodicity of 3.5 years, the stock market remembers 303 days cycle (that has been "forgotten" for a while) and follows it for some time.
We have extracted other strong cycles as well: 708 days, 2.5 years, 2.9 years and 5.8 years. These cycles are displayed in the right window. They all are "favorites" though for different times. Highlight the next one, 360 days cycle, and calculate the spectrum of cycles activity diagram in respect to this 360 days cycle.
Thus, in the same spectrum module, you can now extract two kinds of cycles:
1) Cycles that describe the trend movement (calculated in a regular way through Spectrum window);
2) Cycles that describe the "cycles activity diagram"; in other words, the cycles that reflect the mood of the stock market. We call them W Cycles (wavelet cycles).
These cycles are presented now in the "Cycle Box" window:
The program puts these cycles into the clipboard automatically. You can use these cycles as inputs for Neural Net and calculate the projection line based on both types of cycles, regular and "mood" ones. We provide the step by step instruction how to get the forecast using these cycles in a separate article.
Astronomy based modification of this model
I am pretty much sure that the astronomy based cycles have the impact on the stock market. Moreover, the nature of astronomical phenomena is much more interesting than just being a cause for pushing the prices up/down. It looks like the astronomical cycles change the rules that the stock market follows. The analogy with the weather is suitable here. Planetary cycles provide a kind of mass psychology weather at any given moment of time. In the context of this planetary weather, different cycles have different impact on the stock market, sometimes the same cycles may provide the opposite effect. Thus, as we have stated earlier, in other articles, the impact of astronomical factors on the market is non-linear, and the same factor can provide different effect due to its environment. The astronomical cycles just play important role in this non-linear symphony of Nature.
More than a year ago I have conducted a research analyzing "crazy" zones - the periods when the stock market becomes almost unpredictable. I applied then the phase wavelet decomposition. The most important conclusion was that these zones are better described by astronomy based cycles than by anything else. Here is the link: http://www.alphee.com/reading_room/readairfin/sergey_chaos.htm
It gives us hope that through astronomical cycles, we can get the important additional information about the stock market's "mood" that is impossible to get using regular spectrum analysis. This information, while being additional, is really important. This analogy may clarify the situation: If we compare the stock market to a member of some royal family, and the cycles (revealed by spectrum) to favorites of this person, the role of the trader is that one of a seeker for some benefits. He will go to any of the favorites (or to all of them), trying to get their help. But the royal person (sorry, the stock market) is very capricious, and favorites are changed all the time, and there is no obvious strict rules to follow. What the seeker has to do (i.e., what should the trader do)? - Right, take any piece of information that shows who is in favor at this moment and how long it will continue (or - what is the market's "mood" at the moment and what cycle it follows). It is exactly what Timing Solution (and the new technique described here) does.
Right now, in Timing Solution software, there is a feature to extract the most influential astronomical cycles for any mood/cycles activity diagram. You can do it clicking on this button:
You will see the window where the most influential astronomical cycles for the market's mood are revealed:
The preliminary research shows that the mood cycles improve the forecasting ability of the program. Here is the projection for Ford Motors shares; the blue line is provided by pure spectrum analysis without mood cycles, the red line is the forecast with added mood cycles:
In this example, taking into account the mood cycles gives us a forecast of March-April swing (which actually has occurred), while the blue line (a forecast without mood cycles) skips this swing.
Getting a forecast - step by step guide
We believe that the procedure of creating the projection line is the art. It is impossible to use the same procedure forever and get always a good projection line as well. Life provides us a lot of variety and surprises. But there are still some typical ways of creating a forecast. These ways vary for different time periods and analyzed securities/indexes/currencies, but they are the same for the same type of models. The ways of using the Spectrum module and creating a forecast by cycle based models are shown in this small article: Click here to read it.
You may try to do it yourself. Then we can discuss your results together.
Cyclic model of the stock market: a possible theory
My first approach to stock market data has occurred in Russia, in the middle of 90s. Due to my background in nuclear physics and math methods of data analysis, I have started to look at the market forecast the same way as I used to for any other scientific research. But there was no appropriate software at that time to deal with. Thus, years were spent in building a computer program (programs) that will really help in solving this problem. The following is a brief resume of ideas regarding this problem. It is not just my thoughts, it involves discussions with different people - traders, scientists, etc.
Dealing with consistent data set, any researcher will start from checking the presence of resonant oscillations (own oscillations). Applying this to market forecasting, it means that there are market oscillations that the market "likes" more. Earlier we have compared the market to a member of the royal family; "resonant oscillations" here mean things that this royal person likes always, no matter what are the circumstances or who is in favor. Or, better, things that this being likes or dislikes (these things always provide the same reaction), things that always touch it. Usually, any system has several (or many) different resonant oscillations.
If this idea makes any sense, we can assume that the market (stock, commodities, futures) speaks to the world by the language of these resonant oscillations. And here comes the most interesting part - to understand how much does the market really speaks by this language. There are a lot of possibilities here. One of them is that any event occuring to(with) the market can be expressed through those resonant oscillations. In other words, any market action is a simple sum of involved oscillations. In this case, we deal with a linear system (it is what the physicists prefer).
However, the reality is much more complicated. The language of resonant oscillations intertwines with other factors presented in the world; they all affect the market somehow (just remember so called fundamental factors). And the mutual impact of these factors and resonant oscillations is not obvious. We are dealing here with a non-linear system.
Thus, we have here a wide range of possibilities - from 100% linear system where the result is a mere sum of involved oscillations to a very non-linear system (its extreme is Chaos). Going back to analogy with the royal person, we can say that the linear system means a person who always likes bread with butter and hates porridge. The non-linear system means a person who likes bread and butter and hates porridge while being together with person A, and hates bread and butter being with person B, and loves porridge staying at Bahamas hotel without any person at all.
So, the problem is to understand the market's place in this range of possibilities. Here we have a difference between two the most popular market approaches. Random Walk Theory is the extreme of a non-linear system; this is one side of extreme. Another extreme is the Romantic approach - beliefs that somewhere there is something (a cycle, a magic number, etc.) that can explain all market fluctuations. I prefer the position of the moderate optimist. Briefly, it can be described by these 2 statements (and I can prove any of them):
1) Fixed cycles: the market has a cyclic nature; at least, a part of registered market fluctuations can be explained by resonant oscillations. This part is enough to make a workable forecast. Here is the proof:
This is spectrum for S&P 500 index, 1950 - 2005. The red line uses all available points to calculate the spectrum. The blue and green lines present the spectrums calculated for two different independent intervals (within the main time frame). Dots mark zones where the spectrum peaks for all three lines coincide. In other words, cycles of 2 years, 2.9 years, and 3.5 years (approximately) are presented for both independent intervals. (For exact numbers, try the program Timing Solution.) It means that these cycles are of permanent nature for the S&P 500 index.
2) Astronomical factors: the cycles' impact is in correspondence with the impact of astronomical factors. Astronomical factors mean real physical parameters (such as planetary positions or angles between the planets) that can be found in any reference book or program. It looks like astronomical factors define the environment where the cycles act, and they (astro factors) are responsible for a non-linearity of the whole system.
Here comes a very important notice: astronomical factors are not some fixed parameters. They are changing with the time; in their nature, they are cycles themselves. The difference is that they have a non-regular nature, they are non-even - as opposed to normal, fixed cycles. Thus, markets exist in the continuum of different cycles - astronomical ones that define the scene of the future market fluctuations; and fixed ones that are the actors on this scene. Or, if you would like, we can take the analogy with waves and water. Waves are the fixed cycles; but their height, periodicity and other parameters depend on the environment (whether this is a lake or a running river, winds, the bottom structure, etc.) which is astronomical cycles.
Astronomical cycles are of a great importance. I tried (and I always start the market research with) fixed cycles only (extracted from spectrum); but the involvement of astronomical ones gives better results in forecasting. You have no need to believe me; you can do it yourself.
I need to apologize for the unintended profanation of mathematical ideas. It is not easy to express these ideas without using the formulas. But I hope that the readers have got the impression of the basics of harmonic analysis and non-linear dynamics.
This was the introduction of the theme. It will be continued. I will appreciate any feedback.
August 2, 2005