John Ehler's Rocket Science for technical traders Software Digital Signal Processing Standard Technical Analysis Indicators home page XLTrader Add-ins XLTrader-Talk Google Group contact xltrader xltraders blog members area TA information links

XLCycles.xla - JM Hurst Cycles using Caterpillar

Our aim as stock market timers is to make investing more of a science and less of a game of chance. To do that we need to know as much as possible about price movement. The scientific time-series analysis tools contained in XLCycles.xla and XLCycle.xll make that possible.

Most market observers agree that there are regular oscillations between periods of optimism and pessimism. These mood swings correlate well with rising and falling markets. Our aim is to take advantage of these cycles and the best way to do that is to study the regular oscillations. XLCycles.xla has the state-of-the-art tools that investors of yesteryear could only dream about, that we need to apply time-series analysis to the study of cycles. However, while there is nothing better, even these state-of-the art techniques are not guaranteed to make profits, for there is no speculation --or investment-- that is without risk.

Speaking metaphorically… we stand on the backs of those who came before us. There was Claud Cleeton who used trigonometric regression as explained in his 1976 book: The Art of Independent Investing. XLCycles.xla can do trigonometric regression. There was Herb Brooks who wrote: Investing with a Computer--A Time-Series Analysis approach, who pioneered the use of digital filters. And of course there is John Ehlers, today's foremost cycle analyst. But the best known cycle technician is J.M. Hurst. In 1970 Hurst penned what's become a classic: The Profit Magic of Stock Transaction Timing, in which he argues persuasively in favor of short term trading using cycles.

Trained as an electrical engineer, Hurst's innovation was to use Fourier analysis to detect sinusoids in stock market returns. That had never been done before and proved scientifically the existence of regular oscillations in the DJIA. However, as John Ehlers clearly explains on his website, the Fourier analysis is far from perfect. Burg's method, also known as Maxiumum Entropy Spectral Analysis (MESA) is much better and is included in XLCycles.xla. But what's even more exciting than MESA is a relative newcomer to the time-series analyst's tool box: Singular Spectrum Analysis (SSA).

Imagine if you will a rock quarry where heavy machinery operators carve out hillsides and dump huge buckets of earth onto a belt which streams it into a sieve. The sieve's job is to sift through the rocks and debris separating the gravel from the stones from the boulders. In essence the job of the sieve is to make "order out of chaos". What we need is a "cycle sieve" to extract order out of the chaos streaming out of the markets.

Necessity is the mother of invention and now, thanks to pioneering work of chaos theoreticians (first by Lorenz in 1956 then later, Takens, Broomhead & King, Famer & Packard and others) we have a way to separate the cyclical "wheat from the chafe".

When there is an attractor, the data will reside in a small subspace of the time delay embedding space.... We can define a new set of vectors to eliminate the redundant information that are orthogonal, thus independent

The mathematics behind SSA is known by many names: PCA, Principal Value Decomposition, Singular Value Decomposition, Singular System Analysis, bi-orthoganal decomposition, Karmen Loeve decomposition and the Caterpillar method. But all you need to know is that SSA separates the time series into empirical orthogonal function EOF's or statistical "modes". Usually the majority of the variance in the time-series is contained in the first few EOF's. The patterns of those first few EOF's may be linked to dynamic mechanisms such as the trend and the cycles.

Its a "model-free" statistical approach to "feature detection" in a time-series. Like the sieve at the rock quarry, the SSA algorithm takes data and separates it into statistically independent "streams". These independent data streams are, unlike Mesa or Fourier methods, are not forced to conform to a trigonometric function (or any other function for that matter). As if by magic, SSA extracts order from chaos… and by chaos I mean: the non-linear dynamic system (NLDS) that is presumed to be largely unknowable yet responsible for causing the regular oscillations with which we are all so familiar.

Take a moment to watch a demonstration of XLCycles.xla

But wait! That's not all you get in XLCycles.xla. (Remember these are my personal trading tools and I have thoroughly enjoyed exploring a wide variety of cycle analysis techniques and I'm sure you will too.) You also get the eigen function plot from an SSA decomposition so you will know which eigenvectors to use in the smoothed reconstruction. You get an algorithm for performing trigonometric regression as described in Hurst appendix 6 (and in Cleeton). You get the MESA frequency spectrum (which is not unlike an FFT power spectrum only better). You get a mirror image foldback function and you get some entropy functions which have been discussed recently in TASC magazine and elsewhere. Last but not least, all of the functions on the XLL (shown above) can be called by your own custom formulas and VBA macros.

Singular Spectrum Analysis aka Caterpillar

We use SSA to separate the trend from the cycles. The cycles are further separated from smallest to largest. We toss out the smallest cycles (the noise) and we reconstruct a smoothed replica of the original. We forecast the trend and the cycles we've retained into the future using either SSA or MEM (maximum entropy method). What we end up with is a scientifically based time-series prediction of where the market is likely headed. While, this all may sound complex and confusing, the XLCycles.xla addin makes it easy.

Because of the intensive matrix calculations involved, all algorithms are in a complied XLL (which is like a DLL only specific to MS excel). The XLCycles.xla addin access' the functions in the XLL for you and is designed to work with the event-enabled HLC-Chart.xlt template. HLC-Chart.xlt is configured to work seamlessly with XLTrader™ add-ins.

XLCycles.xla will not work with other templates.The tool bar is accessible from either the Trading day or Calender day graph page on the HLC-Chart.xlt template. When you click on the SSA button, a form pops up asking you to select and confirm a data series.

Clicking on the "YES" button automatically takes you to the data sheet where where the "time pattern filter and forecast" form pops up. This is where you specify the details of the analysis and (optional) forecast. You are also asked to specify a column where the results will be put. The figures below show SSA results from both individual component and and smoothed reconstruction.

SSA Eigenvectors

When we perform an SSA analysis, we specify the time delay embedding dimension. This value specifies the number of EOF's or statistically independent data streams the time series will be separated into. As mentioned above, most of the time series variance is contained in the first few EOF's. The trend component is almost always the first one. When a cycle is present, it will appear as a pair of EOF's which have nearly identical variance. The eigenvector plot lets us visually inspect how the variance is distributed amongs EOF's

Trigonometric Regression

The trigonometric regression algorithm will calculate from the time-series the two dominant sinusoids and a linear trend component. It also lets you forecast the resulting equation into the future.

Mesa Spectrum

The MESA power spectrum plot will calculate for you the dominant periods in the series. Shown below is a MESA power spectrum on the midpoint which gets plotted on the secondary axis and shows cyclical peaks at 10 and 24 bars.

Mirror Image Foldback

Its amazing how many times the market mirrors what happened prior to a major CIT. This module lets you click on and data point as see what would happen if the market reflects what came before.

Entropy

If you are a subscriber to Technical Analysis of Stocks and Commodities magazine then you may have read about "ENTROPY". This module lets you easily calculate those functions (both entropy and probablity). (BTW… The place to learn more about entropic methods is John Conover's NTROPIX website). Get XLCycles by joining XLTrader-Talk Google group today!


XLTrader Add-ins, Templates, etc. work together seamlessly turning Microsoft Excel© into a powerful yet inexpensive Technical Analysis platform. All of the XLTrader add-ins together with the (HLC_Chart.xlt) template to make Technical Analysis as easy as pointing and clicking! You can get get XLTrader by joining XLTrader-Talk google group. The software is a group membership benefit.

answers at your fingertips random image

Sitemap

© 2009 XLTrader Software LLC