Al-Khwarizmi was a Persian mathematician, astronomer, astrologer and geographer whose contributions in these areas provided the foundation for later innovations in algebra and trigonometry. He is considered by many the inventor of algebra.
One of Al-Khwarizmi’s major works was a treaty he wrote in 825 AD on Hindi numerals, which was translated into Latin by the Toledo School in Spain during the 12th century, titled Algoritmi de numero Indorum. This book explained for the first time in the Occidental world the simplicity of the Hindu mathematical calculation, which contributed to the birth of today’s algorithmic calculus. His work substituted long and tedious mathematical demonstration with graphs or charts.
Nowadays, the use of algorithms in the financial community is extensive and dates at least to S. Kaplan’s “Computer Algorithms for Finding Exact Rates of Return” (The Journal of Business, October 1967), which improved the methodology used by Lawrence Fisher when calculating simple investment rate of returns. In other sciences, algorithms have a multitude of uses, ranging from bibliographical and database searches, facial recognition, DNA sequencing, etc. In reality, it is possible for an algorithm to detect the oscillatory properties implicit in nature that have, in fact, been empirically observed in the oscillatory tendencies of financial time series.
There is plenty of statistical evidence that shows that financial time series possess what is known as “long memory,” which could potentially make the search for reliable market patterns a reality. Consequently, the creation of a pattern recognition computational algorithm could be made to detect these oscillatory properties to give traders an edge in the competitive financial arena.
This pattern behavior is present in the Fourier series — more precisely, the Square Wave — that shows how a simple pattern reproduces a repetitive behavior. This can be seen in “History repeats” (right), which can be divided into five parts. The first represents the ascending phase; the second, the horizontal phase, or equilibrium; the third part is the falling phase that leads to a new equilibrium phase; and finally, another ascending phase. For practical purposes, both equilibrium phases are identical and both reproduce a sinusoidal wave that can be subdivided into small sinusoids, waves, and so on.
GENERIC PATTERNS ARE NATURAL
According to Joseph Fourier, who introduced the Fourier series to the world, the equilibrium phase allows for a certain margin of variation, but is always bound within its generic shape. Market analysts have given these variations many names. The most common are referred to as double bottoms or double tops. In our study, these pattern formations are the combination of two, or at most three, simple patterns in different sequences.
The pattern as defined by Fourier as a “U-shaped pattern” may be formed by either an ascent-equilibrium-descent or a descent-equilibrium-ascent. The phase of ascent or descent completes the formation, which has been extensively studied by theoretical mathematicians.
According to Per Bak in How Nature Works: The Science of Self-Organized Critically, the descent phase, which will be the last part of the inverted U-shape, is used to study the phenomena of explosion in non-linear differential equations. This is a falling phase that results from an unstable system that ends in an abrupt movement in the form of an avalanche. Academic studies that explain this explosive phenomena were inaugurated by H. Fujita and continued by the studies of “Brownian Motion” in fluids.
These studies have set the basis for the multidisciplinary approach to the prediction field of financial times series. There are examples in nature that, depending on how they are observed, can yield different results. For instance, the position of the observer can be determinant in the appraisal of the phenomenon. If an observer studies a flock of cormorants during the annual migration, he would find that there is a chaotic situation inside the flock, with a multitude of inexplicable random movements in the individual travelers. However, if the observer leaves the flock, and sees it from the distance, the perception of the observation would be different. What before was chaotic, is perceived as a wave in perfect order.
Along those same lines, if the observer could enter a 10-minute bar chart, he would observe a chaotic numerical interplay, but if he saw that same data from a distance, what was chaos may appear in harmony, depending on the time frame in line with the fractal structure.
Either in the cormorant flock or the bar chart, what we have is a model that behaves as a whole unit that empirically has been shown to posses a long memory. Chaos and order are inexplicably linked depending on the observer’s position. Pattern formations in financial time series have the same attributes.
THE SHORT CYCLE INDICATOR
Now we’ll look at how the Short Cycle Indicator behaves when applied to the Fourier Square Wave. This indicator can be written in any computation language, and it can be used at any compression or sequence for any temporary series, which makes the time variable irrelevant to the study.
This study aims to show that when certain conditions are met, the Short Cycle Indicator has a clear behavior when applied in the transition between the equilibrium phase, as well as the ascent and descent phases of any Fourier Square Wave. When this condition is met, the program (as written in Easylanguage below) draws a green spot to signal an uptrend or a red spot to signal a downtrend.
The core of the algorithm used in this study is shown below as a generic formula, which can be adapted to most forms of analysis software with a system development function:
For ease of application, here is the same formula in Easylanguage, which also includes the plotting component:
Inputs: short(8), fast(20);
Plot1(((power(xaverage(close, fast)-lowest(high, 20),2)+ power(xaverage(close,fast)-highest(low,20),2)/(xaverage(close, fast))/1000)*((xaverage(close, short)-xaverage(close, fast))/xaverage(close, short)*100))/(power(close,2))*1000000,”sc”);
Condition1 = plot1 < -0 and plot1 > plot1 and plot1 > plot1 and plot1 > plot1 and high-low > high-low and low = lowest(low,12);
Note that the above core formula, at times, gives false positives. To eliminate these false positives we can filter with a moving average in the range of 10, 11, 12 for the first exponential moving average (EMA) and 23, 24 and 26 for the second EMA.
The core formula is a variant of the variance between a moving average and the highest high or the lowest low. This is also a stochastic combination due to the use of the highest high and lowest low.
IN THE MARKET
The Dow Jones Industrial Average which appears in “Tracking the Dow” initiated an uptrend at the start of 2003, which remained intact for five straight years. The Short Cycle Indicator is applied only to the VIX and when the green spot appeared at the middle of 2006, we plotted a vertical line which appears automatically in the DJIA and this spot is highlighted by a yellow circle labelled A. From this point, a green trendline was drawn on the chart until the DJIA topped at point B. From the point where the vertical line begins until the topping of the DJIA, roughly a year went by. Therefore, the Short Cycle Indicator becomes a leading indicator applied to the volatility index times series, which would have advised to close long positions and/or to plan a new market strategy.
It’s important to note that the Short Cycle Indicator must be applied to financial time series that follow an ascending fixed and continuous sequence with no gaps. Keep in mind, however, that nature does not always work in the artificial time frames imposed by popular charting software. Rigid daily, weekly and monthly charts will often miss patterns in a 14-day or even 23-day formation.
The Short Cycle Indicator is a leading indicator when applied to any generic U-shaped pattern. The simplicity of this model does not rely on classic chartist formations. The algorithm operates with fixed parameters, eliminating the need for constant fine-tuning that becomes a daunting task and non-scientific. Finally, the application of the Short Cycle Indicator would ultimately allow writing robust computer programs. These programs would help search repetitive patterns providing a real edge to success in the financial markets.
Francisco J. Lorca, Ph.D., is professor of international business, economics and finance at Saint Louis University. He also is the economic and foreign exchange editor for PinHawk LLC. E-mail him at email@example.com.