Presentation on theme: "Dr. Cleber Gomes is an Electronic Engineer graduated from UFRJ and has a Ph.D. from Tokyo University of Technology and Agriculture. He lived for 7 years."— Presentation transcript:
Dr. Cleber Gomes is an Electronic Engineer graduated from UFRJ and has a Ph.D. from Tokyo University of Technology and Agriculture. He lived for 7 years in Tokyo where worked as a researcher in top companies as NEC and Sharp. He also lived for 7 years in Israel, where occupied positions of managing and of research and development in software companies in the fields of pattern recognition, artificial inteligence, distributed processing and security for the Unix system.
The following presentation will cover the topics below: Dynamical Complex Systems – The Logic of the Irrational The Stock Market as a Dynamical Complex System Can the Stock Market be predicted? Predicting the Stock Market Our Forecasting System Conclusions and Future Steps
Dynamical Complex Systems – The Logic of the Irrational Dynamical Complex Systems are those systems capable of presenting a behavior that, though apparently random, may often hide an intrinsicaly order difficult to be understood at first sight. Some examples of this kind of systems are the climate, the immunologic system, the human society and the stock market among others. They present common characteristics that make them inherently unpredictable in the long term, as for example the non-linearity.
In non-linear systems, the output is not proportional to the input as it happens in linear systems, and therefore, small changes in the input conditions may lead to big changes in the output conditions:
A good example of this effect, and easily visualized, is the avalanche that may take place in a sand pile as result of the fall of only one grain. In this case, the small event represented by the fall of that grain triggers a chain reaction that culminates in the dislocation of thousands of others:
Besides this non-linear effect, dynamical complex systems are characterized also by a feedback mechanism between the output and the input of the system. That is, besides the fact that small variations in the input may cause big fluctuations in the output, due to the non- linearity, these fluctuations in the output are transferred again to the input, influencing the system ad-infinitum:
That is what leads to the unpredictability of such systems in the long term, because small changes in the initial conditions are exponentially amplified with time, originating totally different behaviors in the future:
Such characteristic of dynamical complex systems became also known as The Butterfly Effect, defined by Edward Lorenz in the following terms: The flapping of a butterflys wing produces today a minuscule alteration in the state of the atmosphere. After some time, what the atmosphere effectively does diverges from what it would have done, if it wasnt for that alteration. Therefore, after a month, a hurricane that would have devastated Indonesias coast doesnt happen. Or it happens one that normally wouldnt.
Even though dynamical complex systems are unpredictable in the long term, it may be possible to predict them in the short and medium terms, due to the order they present in their behavior. As random this behavior may appear to be, it often hides a certain intrinsic order. This order is generally not visible when we look at the evolution of the system in time, but emerges when we draw its trajectory in a phase space.
The phase space is nothing more than a graphic where each dimension corresponds to one variable or parameter of the system, and the variables are drawn against each other to show the trajectory of the system as a whole:
When the evolution of a system in phase space always tends to follow a certain preferred trajectory, it is said that such trajectory represents the attractor of the system. The attractor is a trajectory or position of equilibrium within phase space, in such a way that even if other position is the initial one, the system always evolves towards it. A simple example of an attractor would be the center of a spherical basin containing a small ball:
Depending on the system, attractors can be regular as the orbit of planets, periodical as the cycle of oscillation of pendulums, or can represent an infinite sequence of states that, though never repeating itself, remains always contained within the boundaries of a restricted area within phase space:
We call this last case a strange attractor. In dynamical complex systems that present a strange attractor, there is an intrinsic order because the trajectory followed by the system is limited to the attractor and, consequently, it may to a certain extent be predicted.
The first to analyze deeply dynamical complex systems was the american meteorologist Edward Lorenz, who, during the sixties, studied a model of the climate in three dimensions, and found out that the variables x, y and z of such model always followed a trajectory in phase space that resembled a double spiral:
Lorenz had discovered the first strange attractor of a dynamical complex system simulated in a computer, which became known as the Lorenz attractor. The model studied by Lorenz consisted in the following set of non-linear differential equations: dx / dt = a (y - x) dy / dt = x (b - z) - y dz / dt = xy - c z a,b,c constants.
As we can see, the equations of Lorenz model describe a system of the kind mentioned before, non-linear and based on a feedback mechanism. The feedback mechanism is present because at each moment the variation of the parameters x, y and z is used to determine their values in the next iteration:
The computer simulation of these equations can give us the opportunity to observe a simplification of the kind of behavior that is generally presented by real dynamical complex systems, as for instance the stock market. It is possible to visualize that such behavior is characterized by a great sensibility to variations in the initial values of the systems parameters, and by the non-periodic and seemingly random way these parameters evolve with time. To illustrate this kind of behavior, we prepared a set of java applets to simulate Lorenz equations.
The first applet to the left shows the trajectory of the system in phase space, where we draw the parameters x+y against z. The second applet shows the same trajectory with time, in the graphic where we draw x+y+z against t. The third applet shows the summation of the initial values of the variables. These initial values of x, y and z are determined by the position of the mouse within phase space:
When we click the mouse at the same point of phase space three times in a rapid sequence, we initialize the system with three sets of initial values for x, y e z that, though distinct, are very close to each other. We obtain therefore three initial conditions almost identical, making it possible to observe the sensibility of the system to small variations in its initial conditions.
The behaviors of the system for the three sets of initial conditions are represented below by the red, green and blue lines. We observe then, that in their initial stage, the three systems evolve together:
And then, after a short period of time, they diverge abruptly:
For, in the future, presenting totally different behaviors. We have then, an illustration of how the future behavior of this kind of system is strongly influenced by small changes in its initial conditions:
Besides the sensibility to initial conditions, other interesting characteristic of dynamical complex systems may be also observed as time passes. After a longer period of time, it is possible to observe in the applet to the right how the behavior of the system against time seems to be a totally disorderly and random signal. However, despite this apparent randomness, the attractor visible in phase space to the left demonstrates clearly that there is an order hidden in this behavior:
Both applets show the evolution of the same signal, but represented in two different ways. T represents the transformation, or change of coordinates, that makes the attractor of the system visible, and thus makes it possible for the order hidden in the behavior of the signal to emerge:
That is, though appearing to be random when observed through time, systems like this present actually an ordered behavior that is always attracted towards a finite structure, the strange attractor of the system. In this case, the attractor that denotes the order inherent to the system is the Lorenz attractor.
Thus, though the behavior of dynamical complex systems never repeats itself, short-term prediction is in principle possible. The possibility of prediction exists due to the order inherent to such systems, which must be extracted from their behavior by the correct transformation. In the case of a simple system as that represented by Lorenz equations, this transformation T is the mere change of coordinates that makes it possible to find the attractor of the system. However, for real-life systems, like those found in nature and the financial markets, T is of difficult solution, demanding several processing stages. In the rest of the presentation, we will demonstrate a prediction system that tries to solve the transformation T, thus making it possible for the hidden order within the stock market to emerge.
The Stock Market as a Dynamical Complex System The Stock Market is a game of great complexity, consisting of a large number of human agents that buy and sell stocks, by following their individual expectations with regard to the future behavior of prices. The agents who operate in this market present, for being human, a tendency to base their decisions on emotional factors, as fear and euphoria, which can not be described in a linear fashion.
For instance, the operators holding a certain stock that has suffered a great fall yesterday, will probably try selling it today, motivated by the expectation or fear that the falling will continue. Some will wait longer than others to sell, and some will do so only if the price falls beyond a certain level, or stop, attaching a high degree of non-linearity to the process. This collective propensity for selling will, in its turn, accelerate the falling of prices in a positive feedback process.
This kind of feedback process is responsible for the so-called herd effect. In this process, the progressive falling of a stocks price P increases the expectation of fall EF the market operators hold related to the stock, what in turn reinforces the falling tendency:
Such feedback mechanism, together with the non-linearity inherent to human decisions, is what makes the stock market behave basically as a dynamical complex system.
Can the Stock Market be predicted? If the stock market really behaves as a dynamical complex system, there may be an intrinsic order behind the appearing randomness of stocks prices, which makes short-term predictions possible. If such order really exists, it is due to the non-instantaneous way people react to new information, not taking decisions until new tendencies emerge, and then collaborating to strengthen such tendencies. If that is the case, then stocks prices are not random, behaving as a chance walk, but present a memory period during which past events keep influencing future events.
There is a statistical parameter, known as Hurst Exponent (H), which can be used to measure the presence of a bias, or memory effect, in temporal series that behave seemingly as chance walks. The Hurst Exponent was created by Harold Hurst, a hydrologist who, while studying Niles flow patterns, discovered that several natural systems follow the pattern of a biased chance walk, or a tendency with superposed noise. H, then, would be useful to measure the relationship between the strength of tendency and the noise level in the behavior of such systems.
The value of H belongs in the interval between 0 and 1, and can be understood as the probability that an increase in the level of a signal today will repeat itself within a certain time. When H is equal to 0,5, there is a 50% probability of repetition, or the signal is random. For H larger than 0,5, as the probability of repetition is higher than 50%, the signal is not random and presents the kind of behavior called persistent. For values lower than 0,5, the signal is called anti-persistent, or there is a probability higher than 50% that increases today lead to decreases after the considered time period.
It is easy to understand that the value of H of a signal depends on the repetition period, or cycle, being analyzed. For instance, a signal may present a tendency to repeat peaks in a weekly cycle but to be completely random on the daily. In that case, we would have H equal to 0,5 for the daily cycle and larger than 0,5 for the weekly cycle.
In the case of a sine wave, for example, we have H equal to 1 for a cycle equal to the wave period, and equal to 0 for a cycle equal to half period. That is because we can always expect a peak today to be followed by another within 1 wave period, and by a valley after half period:
In the case of more complex signals, as for example temporal series of stocks prices, we can only estimate H as the average probability of repetition for highs or lows within several different cycle lengths. Given H, we can say for instance, that there is a 70% probability that a high today will lead to a high some day in the next month. It is, however, impossible to precise exactly when such high will occur.
Therefore, even though H can not be used directly for the purpose of prediction, it can be used to test the hypothesis that prices are not random, but present an intrinsic order, and that, consequently, prediction is not impossible. With this purpose, we measured H for 6 stocks negotiated in the Bovespa, taking into account their prices between January 2003 and December The tested stocks are the following:
The following graphics show the results of H. These graphics represent the average values of H for several different cycle ranges. The ranges go from 2 to 12 days up to the extension of the whole temporal series.
For Petrobras, we found the maximum value of H to be equal to 0,75, for the range between 2 and 12 days. That is, in the case of a high today, there is a 75% probability of a high sometime between tomorrow and 12 days in the future:
For Embraer, we found the maximum value of H to be equal to 0,77, for the range between 2 and 12 days. That is, in the case of a high today, there is a 77% probability of a high sometime between tomorrow and 12 days in the future:
For Vale, we found the maximum value of H to be equal to 0,77, for the range between 2 and 13 days:
For Siderúrgica de Tubarão, we found the maximum value of H to be equal to 0,77, for the range between 2 and 12 days:
For Eletropaulo, we found the maximum value of H to be equal to 0,76, for the range between 2 and 12 days:
For Telemar, we found the maximum value of H to be equal to 0,74, for the range between 2 and 12 days. That is, in the case of a high today, there is a 74% probability of a high sometime between tomorrow and 12 days in the future:
As we can see, for all 6 analyzed stocks there is a strong probability, between 70 and 80%, of repetition of todays tendency during the next 10 days approximately. Moreover, this probability decreases rapidly the further in the future we look. In other words, the stocks show a strong short-term memory effect.
These results are meaningful for proving that stocks prices do not vary randomly, but behave following an inherent order as it happens with dynamical complex systems. For effectively predicting their future behavior it is necessary, however, to develop the correct transformations, or models, capable to detect such order and to make it intelligible.
Predicting the Stock Market There are basically three main schools for analyzing the stock market, which try to predict its future behavior. Each one of them offers its own arsenal of methods and techniques for guiding efficient capital allocation, with the purpose of maximizing profit and minimizing risk. Two of the schools, the fundamentalist and the graphical, are widely known, while the third, which is concerned with the non-linear analysis of temporal series, is not so commonly used.
The fundamentalist analysis is based on informations about the financial health of companies, as profitability, cash generation and debt, to select the stocks with higher probability of gain and less risk. Its greater advantage is that, most of times, the long-term behavior of stocks reflects well the fundaments of their respective companies. Its disadvantage, however, is that the fundamentalist analysis can not predict medium and short-term price variations, which are more influenced by strong non-linear factors.
The graphical analysis, on its turn, tries to predict those medium and short-term price variations, based on the attempt of recognizing graphical patterns on the prices of stocks. These patterns, because of presenting a tendency for repetition, would be useful as good guidelines to indicate prices future behavior. The advantage of graphical analysis is the relative simplicity and facility encountered by analysts to understand and use its tools and results. Its main disadvantage, however, is also due to the large dissemination of those tools, because no analyst can achieve a consistent advantage over the others by using a technology known by all.
A good analogy of such point of view would be a poker game during which one of the players suddenly acquires the ability to see through the first card of its opponents. As long as he is the only one capable of that, he will have an expressive advantage over the others and probably will make a lot of money on the long run:
However, as the others learn the same trick, all players will again move into an equilibrium position, in which nobody attains a consistent advantage beyond ones own talent:
The non-linear analysis, on its turn, treats temporal series of prices as any other kind of signal to be analyzed through advanced and relatively new techniques from Information Technology. Such techniques include Chaos Theory, Neural Nets, Genetic Algorithms and Fuzzy Logic for signal processing and pattern recognition. The advantage of this kind of technology is its non-linear and multidimensional nature, which, for treating the stock market as the dynamical complex system it basically is, stands a better chance to effectively predict the medium and short- term behaviors of prices. However, the impossibility of long-term predictions still remains, due to the sensibility to initial conditions inherent to the own market.
From the users point of view, the relative complexity and difficulty of understanding such tools and their results, are both an advantage and a disadvantage. Disadvantage due to the difficulty encountered in using the related techniques, but advantage due to the acquisition by those analysts capable of mastering them, of a more powerful and consistent weapon to be used in the markets game.
Back to the poker game analogy, mastering the non-linear analysis techniques would be equivalent to obtaining the ability to see through opponents first and second cards:
In the next slides, we will describe the functioning and results obtained with our prediction system, which was designed based on the state-of- the-art technologies used in non-linear analysis. We believe that results demonstrated so far prove that it is possible to obtain, through the use of such techniques, that small advantage which, like in the game of poker, can guarantee consistent profits in the stock market.
Our Prediction System
In our system the signal passes through a series of processing layers, becoming more intelligent, or ordered, on its way from lower to higher level stages. Thus, the initial temporal series of stock prices produces at the end buying and selling signals for each analyzed company:
Our system was developed along the following lines: Maximizing the relationship between profit and risk of trades. Minimizing the number of trades when possible. Adapting the processing models to each stocks individual characteristics. Adapting the processing models to markets current conditions.
The following figure shows the simplified system architecture and its stages. The double spiral exemplifies the order representing structure, or atractor of the input temporal series, to be understood by the system:
In case of complex signals like a stock price series, such atractor is probably not a stationary one like Lorenz double spiral, but varies with time instead, denoting an order structure in constant mutation. Predicting the behavior of stocks becomes then, analogous to trying to hit the center of a moving target:
Therefore, it is important to give to the prediction systems internal models the capability of dynamical adaptation to the current conditions of the market. Besides, the prediction system must also be able to adapt its own internal structure to the individual characteristics of each analyzed stock. The behavior of each stock is directly influenced by the expectation of the agents regarding its evolution with time. Thus, each stock ends up acquiring its own personality which must be captured by the system.
Conclusions and Future Steps Judging by the results obtained by our system until now, we believe having developed a technological platform for predicting the stock market, capable of demonstrating a high relationship between probability of gain and associated risk.
Based on the premise that the fundamental dynamics behind stock market agents behavior is independent from geographic location, being though influenced by external factors, as for instance the cultural ones, we developed a system that seeks to capture the essence of that dynamics, while keeping the capability to adapt to its local and time variations.
Therefore, due to the flexibility of the used architecture, it will be possible to analyze a growing number of assets, negotiated in the most important markets in the world, as for instance NYSE, NASDAQ, Frankfurt, London, Tokyo, Madrid, Paris etc. The analysis will also be extendable to all operational time horizons, including intra-day, short and medium terms.