Using Digital Signal Processing in Quantitative Trading Strategies

Source: Robot Wealth

In this post, we look at tools and functions from the field of digital signal processing. Can these tools be useful to us as quantitative traders?

What’s a Digital Signal?
A digital signal is a representation of physical phenomena created by sampling that phenomena at discrete time intervals.

If you think about the way we typically construct a price chart, there are obvious parallels: we sample a stream of ticks at regular intervals and treat that sample as our measure of price. (Of course, we often aggregate or summarize price data at such intervals too, creating the familiar open-high-low-close bars or candles).

You can, therefore, see the connection between digital signals and analysis of time-based financial data.

And since the techniques used to process and make sense of digital signals have proven their worth in electrical engineering, telecommunications and other fields, it is tempting to assume that they can unravel the mysteries of the financial markets too.

However, the existence of such a connection doesn’t necessarily imply that DSP holds the key to the markets, or indeed that it is of any use at all in financial applications.

Financial data is much, much noisier than the data in those other applications, for example.

We Need to Talk About Cycles
The purpose of most of the DSP tools you’ll come across, including the ones implemented in the Zorro Trading Automation Software, is to uncover useful information about some aspect of one or more cycles present in the signal being analyzed.

A cycle is a repeating pattern (although non-repeating cycles can also exist), and it can be described by its:

period (T) – how much time is taken by one complete cycle.
frequency (f) – how many times it repeats in a given time interval. Frequency and period are inversely related: f=1T
amplitude (A) – the magnitude of the distance between the peak and trough of the cycle. Often A is given as a distance from the midline to the peak (equivalently, the midline to the trough), but in Zorro’s functions it is the peak-to-trough range.
phase (θ) – the fraction of the cycle that has been completed at any point in time (usually measured in degrees or radians). By definition, one complete cycle occupies 2π radians, or 360 degrees.
Here’s one full cycle of a sine wave with an amplitude of 2 (the peak is at one, the trough is at minus one):

Here’s an example of a time series with a clear cycle and trend component:

And here’s one that I constructed by adding various trends and cycles with different amplitudes, phases and frequencies:

The last plot above was generated using this R code.