Cycles and spectral analysis

Posted By: boatman

Cycles and spectral analysis - 03/16/15 06:42

I had meant to start this thread last week, but my wife and I were busy having our first child. laugh

GPEngine made a very interesting post about the ephemeral and fickle nature of market cycles detected by Zorro's Spectrum function. He found that dominant cycles detected over a large period of time are not necessarily replicated in shorter time spans within the whole series, and that dominant cycles reported by the Spectrum function tend to be biased towards whatever was the strongest cycle (that is, greatest amplitude) rather than that which was the most consistent.
(Please correct me if I am misunderstanding your research, GPEngine).

To me, this suggests a couple of approaches:

1. A tweak to the design of Zorro's Spectrum function, or the addition of a new function altogether that can report the most persistent cycles, rather than the strongest in terms of amplitude. jcl, is this possible?

2. Another approach is analogous to the 'parameterless' strategy that is retrained at regular intervals. If you wanted to use the most tradable cycles in your strategy, you could periodically run the Spectrum function across some recent price history and observe the strongest peaks. Then, using a cycle period detection function (such as DominantPeriod or Ehlers' Autocorrelation periodogram), it would be possible to identify the onset of a cycle with a period that was tradeable in the recent past. Assuming* that the cycle remains significant in the short term, this could be a trading opportunity.

*This assumption may or may not be all that reliable. However, I do think that it would be more reliable if we could use the Spectrum function (or other similar method) to identify the consistent cycles, as well as those with the amplitude peaks.

Using a bandpass or roofing filter to capture a relatively small range of potentially tradeable cycles (say, 15-30 bars for simplicity), we see that for the most part, we can identify some excellent trading opportunities and some very poor trading opportunities. I have found it impossible to construct a strategy that exploits cycles by simply using such a filter. The difficulties as I see them are:

1. Sometimes the trend swamps the cycle. For example in a downtrend, even if you got in at the bottom of a cycle and out at the top, if the downtrend is strong enough you still lose.

2. Sometimes the range of the bars is so wide that you get a similar problem to that described in (1). Ehlers talks about this in terms of the 'signal to noise ratio'.

3. Sometimes it is possible to identify a cycle and enter in a timely manner, but the cycle's amplitude means that it is not tradeable.

If we knew which cycles were recently both persistent and of high enough amplitude, we could potentially use that knowledge as a trade filter to overcome (3).

I realise that there are a number of assumptions in the above, and that some of them may be quite tenuous. I think it would be worth pursuing this avenue of investigation though, since we only need a small edge to make money, and the theory seems to stack up (in my mind anyway).
Posted By: jcl

Re: Cycles and spectral analysis - 03/16/15 16:06

Detecting cycles has the same basic problem as many other trade algorithms. Using a short time period, you can detect cycles fast, but are then not safe against false cycles by random effects. If you sample over a long period, you can better distinguish real market cycles, but they may be over when you start exploiting them.

We will however implement a new spectrum function where you can set up the sample period, so you have at least control over that.
Posted By: GPEngine

Re: Cycles and spectral analysis - 03/21/15 14:49

Your understanding is correct.

Let's fast-forward and say you get the discovery and detection tools you want. And then you discover that there is a persistent cycle for some wide-enough period which can be detected reliably. And there is enough time remaining to take advantage of it before it disappears.
How do you take advantage of it?
  • Sell at the peaks of a smoothed BandPass(Price, C, 0.5) and buy at the valleys?
  • Synthesize the cycle independently from the series, using sin(Phase)?
Posted By: boatman

Re: Cycles and spectral analysis - 03/22/15 09:10

I would use a multi-pronged approach and test the two approaches you mentioned as well as Ehlers' roofing filter tuned to the cycle period. Ehlers recommends a signal line for triggering trades which is simply the indicator crossing itself delayed by one or two bars.

I would also test Ehlers' adaptive RSI and Stochastic tuned to the detected cycle.

It seems to me that these approaches give some very good signals and some very bad ones. But knowing a little more than we currently do about tradeable cycles, I think we could filter at least some of these bad signals. Whether that is enough to make such a system profitable is another question entirely.
© 2024 lite-C Forums