Feb 23
In the previous post I pointed out a model developed by researchers at the University of Surrey for analysing volatile financial time series. The model is actually quite straight forward to implement and my initial plan was to reproduce it, but haven’t got round to doing so because of other commitments. Nonetheless the plan continues and I shall be posting details of the modifications I wish to make to the model already proposed.
I found a poster presentation drawn up by the same researchers which provides a good summary of the paper they published.

Alternatively you can download a PDF file of the diagram from here.
Bookmark & Share
Feb 17
This presentation covers almost everything I have been wanting to convey about the usefulness of wavelets.
The researchers propose a prototype feature extraction system, the block diagram of which is reproduced below:

Questions I ask:
- It appears that the researchers settled for a fixed wavelet function for doing the decomposition. Are there any benefits in using a hybrid of different wavelet families for decomposing different parts of the time series?
- Is it possible to create a custom wavelet family with the aim that it works better than the other wavelet families commonly used? What should be the line of approach to this kind of problem? Inductive or Deductive?
I am tempted to write a Matlab model to replicate this system and maybe adapt it a little bit, but there is a paper written by the researchers that needs to be understood first. You can download it from here.
Bookmark & Share
Feb 17
The purpose of this post is two fold:
- Discuss aspects of the Fourier Transform that will form necessary grounding for subsequent understanding of the Wavelet Transform.
- State why Fourier Transforms are inappropriate for analyzing financial time series data.
The Fourier Transform
In the previous post I hinted at the relationship between the time domain and the frequency domain representations of a signal. The figure below gives a clearer picture of that

A signal that oscillates rapidly with respect to time has a higher frequency relative to one that oscillates slowly. A pure sine wave has only one frequency component, but not all signals are sinusoidal - some may be composed of a number of different frequency signals added together, others such as stock prices can have signal frequency components that change with time. In order to determine the frequency content of a signal, one needs to perform a conversion into the frequency domain, there by giving us a view in the direction shown by the yellow arrow in the figure above (the spectrum of the signal).
The Fourier transform is one of a number of algorithms that provide a way evaluating the frequency content of a signal. The transformation into the frequency domain follows the equation

and the inverse Fourier transform is

Now the equations listed above belong to one of the many variants of the Fourier transform - the Continuous Time Continuous Frequency Fourier transform. There are few general points to note:
- The equation of the Fourier transform tells us that the integration needs to occur for all times within the range
to
. The implication of this is that the occurrence of time domain signal
needs to exist for any value of time within the said range.
- For the given integration bounds, frequency
needs to be a constant value. This implies that signal
needs to be time-invariant i.e. stationary.

I have drawn up a chart showing the different variants of the FT and their relationship with each other. The diagram is work in progress so please feel free to recommend any changes that can be made. I intend to extend the family tree to show other transforms relevant to our discussions.
The choice of invoking a particular transform depends on the nature of the signal undergoing the transformation (continuous or discrete in time) and the level of detail we wish to obtain in the frequency domain (continuous or discrete frequency bins). This also applies to the inverse Transform.
I do not wish to talk any more than this about the FT as I have provided a few good resources at the end of this post to complement what has already been discussed.
Application to financial time series data
There are two main reasons why FTs are inappropriate for analyzing financial data:
- Bullet points (1.) and (2.) above do not hold for stock prices or any other asset price. Particularly with regard to bullet point (2.) stock prices do not have a constant frequency with respect to time. This points to another short-coming of the algorithm - it tells us nothing about the points at which a frequency change occurs in the time domain, which is essentially one of the things we want to know.
- The other reason is that FTs deliver poor resolution for cycle period measurement. Suppose we perform a 128-point FFT. The largest cycle the algorithm can record is 128 bars. Cycles larger than 128 cannot be recorded because the window length is not large enough for it to be captured fully. One may wish to increase the window length, but it is likely that stationarity is not maintained. And also, only cycles that are an integer power of two (2, 4, 8, 16, 32, 64) can be recorded (in the case of the DTDF transform). Anything that falls between these boundaries cannot be measured accurately as it is mathematically impossible for the algorithm to do so.
Further Reading:
Bookmark & Share
Feb 10
Here I write about things that may aid those who are new to Signal Processing to grasp a few concepts without necessarily referring to a textbook.
The table below shows some the differences between a Wave and a Wavelet.

Essentially a Wavelet is a small wave with pretty much the opposite characteristics to that of a wave. This is exactly what makes their application appealing to time variant signals such as stock prices. Accompanying wavelets is the Wavelet transform algorithm, of which there are many variants, but all essentially do the same thing using different ways. The table below shows the difference between two contrasting analytical algorithms.

So what are these “domains” we are referring to? Any signal that is a function of time is in the time domain. Stock prices are in the time domain because the each point in time has a price associated with it. Now consider another time domain signal such as a sine wave. Lets assume that this signal has amplitude 2 and takes 5 seconds before it begins to repeat itself i.e. it’s period is 5 seconds. Now the frequency of this signal is the inverse of the period which is 0.2 hertz in our case. Also the amplitude of the signal is the in the frequency domain our sine wave will look like a single spike of height 2 at the point 0.2 hertz. This is because the frequency domain shows the amplitude or power of the signal (y-axis) for different frequencies (x-axis), which is referred to as the spectrum. The spectrum of a stock price takes a more complicated form and is more difficult to determine, but the wavelet transform takes care of that.
Now it is worth pointing out that wavelets are usually combined with other signal processing algorithms to form “systems” that enable the transformation from the time domain into the frequency domain to happen in particular ways, depending on what you want to achieve. For instance instead of determining the spectrum of the stock price one may want to develop a filtering scheme or a trend/cycle estimation scheme. We shall see more of that later.
Bookmark & Share
Feb 07
For those not too familiar with wavelet theory I have attached some notes here for easy view. The idea of a non-fixed sampling rate is fundamental to the Wavelet Transform and it is very important to understand these concepts before delving into actual applications. The newbie may find some of the material heavy going in terms of the maths involved, but I believe understanding ideas are more important than being able to evaluate intagrals.
The first set of notes presents basic multirate concepts. The notion of upsampling and downsampling are discussed in terms of time and frequency domain characteristics.
The second set of notes gives a very friendly introduction to the Wavelet Transform and shows it’s advantages over the Fourier Transform.
I have also attached a very readable paper titled “Wavelets for kids“. You can download it from here
Over the next few posts we shall look at some wavelet decomposition models for financial time series.
Bookmark & Share
Feb 03
I wish to start discussing wavelets, which is yet another branch of signal processing that has had success in feature extraction and volatility forecasting for time series. I suggest the following three excellent books for the reader who is interested in wavelets:
Additionally there are numerous web resources on wavelets and the like, with about two million hits via google search.
Bookmark & Share
Feb 03
In addition to Matlab, The Mathworks offer a product called Simulink which is a design platform for implementing and testing model-based systems. Most of my experience using Simulink borders on modelling Control Systems and DSP architectures. However, as the Mathworks have pointed out in a recent webinar, Simulink can be extended to develop and test finance based models such as a trading system or sub-systems that form part of a larger model.
I decided to implemented a Hilbert Transformer model for price data using Simulink which is shown below:

The model has input “simin” which takes the price data from the matlab workspace as discrete points one at a time and applies unit delay (represented by “1/Z”) and gain which is basically multiplication by the shown number. Individual Real and Complex parts are combined to create complex numbers which is then outputted to the workspace.
Simply put, the Hilbert Transform converts price data into complex number form so that one may go about calculating different measures that are not possible to calculate using just the price itself. My previous post mentions measures that are calculated using hilbert transformed price. The relationship between the actual price and the hilbert transformed price is
for a hilbert price
.
As one would expect the model implemented above suffers lag. This is confirmed by comparing the Actual price with the price reconstructed from the hilbert complex numbers:

The model does not induce any loss or gain in magnitude, but there is a lag of 4 bars. This implies that the hilbert price for the current bar actually corresponds to the price 4 bars ago - something we should consider when using hilbert prices to deduce other measures.
Other Links:
- The wikipedia page covers basics of the hilbert transform.
- The Mathworks have a webinar which has a section on using Simulink for designing and testing Algorithmic Trading models. You can view this webinar here. Its round about 40:00mins into the presentation where the section on Simulink begins.
- Simulink totorial can be found here.
- There a number of webinars and example models at the Mathworks website for one to get started using simulink.
Bookmark & Share