Apr 15
http://asa-caltech.sourceforge.net/
I highly recommend this tool for your Optimisation purposes - very efficient code and a good example for learning how to implement Simulated Annealing Algorithm in C. What what inspires me is the approach the coder of the tool (Lester Ingber) has taken to implement the algorithm - well organised structure highlighting the prime benefits of C over Matlab.
Bookmark & Share
Apr 06
The reason I tool the about page offline was that it did not accurately reflect the focus of this blog. I have drawn up a new chart that is supposed to replace the old one, and apart from it reflecting some of the topics I write about here I would like it to serve as a general chart that shows how Signal Processing and Machine Learning come together in developing Financial models. Please comment on any addition/alteration that can be made.
Bookmark & Share
Apr 06
While reading on the subject of hard to forecast events I decided to investigate what the Signal Processing domain had to offer in terms of models that account for “fat-tail” distributions. Thankfully I came across a set of papers that specifically address the nature of such distributions in their modeling approach - which I think is insightful and worth having a look at despite being off-topic to quant work.
The set of papers was collectively published in a special edition journal under the theme “Signal processing with heavy-tailed distributions” and can be found here. I have uploaded the preface to the journal which gives a good overview of applications. You can download it from here.
Bookmark & Share
Apr 06
Seriously, Graphviz is such an excellent graph plotting tool. I have used it on many occasions here and find myself using it more often than Visio. Might be useful to some who have not come across it before:
http://www.graphviz.org/
Bookmark & Share
Apr 02
Nassim Nicholas Taleb is co-editing a special issue of the International Journal of Forecasting with focus on “decision making and planning under low levels of predictability”. The official invite can be found here and while I will not be submitting a paper, I will surely obtain a copy of the issue when it is published.
Bookmark & Share
Mar 25
In a previous post regarding a modified wavelet feature extraction model I talked about replacing the DWT/FFT part with a customized Hilbert Transform for the purpose of capturing cyclic behavior of the price data. Here I discuss this in more detail and introduce the first of 3 Hilbert Transformer variants I am excited about.
For those not too familiar with phasors please have a look at the following links:
Simply put a phasor is an alternative way of representing a time-domain signal using a complex set of measures namely InPhase and Quadature. Recall that Hilbert Transformed signal takes the form
where
is the “real” or InPhase part and
is the “imaginary” or Quadrature part. Plotting
and
on the complex plane and tracing out the trajectory formed by the phasor is supposed to reveal, among other things, the cyclic components of the signal.
There are many variants of the Hilbert Transform, but they all have a common structure which was popularized by [Ehlers]. For future reference we shall refer to Ehlers’ model as Variant 1.

Applying a chirp signal to the input:

Due to the phase differential between the InPhase and Quadrature signals it becomes possible to trace out the trajectory taken by the phasor on the complex plane. The figure to the left shows this for a signal with frequency 20bars/cycle. Now if we superimpose a short
term cycle on a longer one we see a change in the trajectory due to the presence of the new cycle. The figure to the right shows this. Notice that the cycle only shows up on the phasor plot with a lag of 4 bars. We were expecting a shift after the 10th bar, but only appeared after the 14th bar.
Short term cycles show up as a distortion of circles with bigger diameter and it is possible to use this feature to visualize underlying behavior in price data or any financial time series for that matter. I simulated a 31 step Brownian motion with drift = 10, diffusion = 10 and evaluated it’s complex phasor. We can clearly see how short term cycles influence longer term cycles, which is not obvious by inspecting the time series alone.

Inspecting the phasor plot we can see the presence of cycles as represented by circular features being formed by individual points. The following cycles exist:
- Cycle 1: On Phasor plot points 7, 8, 9 => 3 bar cycle. On time series plot this cycle pertains to points 3, 4, 5.
- Cycle 2: On Phasor plot points 12, 13, 14, 15, 16, 17 => 6 bar cycle. On time series plot this cycle pertains to points 8, 9, 10, 11, 12, 13.
- Cycle 3: On Phasor plot points 25, 26, 27, 28, 29, 30, 31 => incomplete cycle. On time series plot this cycle pertains to points 21, 22, 23, 24, 25, 26, 27.
We also make the following observations:
- Cycles 1 and 2 could actually be noise. We can only confirm this if we define a minimum diameter for a circular feature to qualify as a cycle and ignore all those with diameter less than the minimum.
- Cycle 1 & 2 distort cycle 3.
- Cycle 3 is incomplete but is the dominant one. The only way can predict its frequency is to count the number of points in the 2nd quadrant (points 26, 27, 28, 29, 30) and multiply by 4. Given that there are 5 points we predict that Cycle 3 is roughly a 20 bar cycle.
Key Points:
- The Complex Phasor plot provides an excellent way of visualizing cycles and how they interact with each other. A cycle is one complete circular feature whose frequency is equal to the number of complex price points forming that circle.
- Due to the lag constraint of Hilbert Transformer model used in this test (Variant 1) it is only possible to view cycles with a lag of 4 bars. In future I shall discuss Variants 2 and 3 which attempt to detect cycles with less lag.
- It is possible to develop a trading strategy that exploits the cycle information obtained via Hilbert Transform. For instance we could use the InPhase vector as an anchor to decide when to buy or sell depending on whether pre-defined lines/points on the complex plane have been crossed. I have high hopes for such a method, particularly in an algorithmic trading setting.
- It may actually be usefull to filter the input data before evaluating its complex phasor, but this may distort any micro-structure that may exist in the time series. It all depends how much filtering is acceptable.
Bookmark & Share
Mar 15
In an earlier post I mentioned a filtering algorithm which demonstrated negative lag for low frequencies (trending market) and high magnitude gain for higher frequencies (cyclic market). I modified the algorithm to deal with the high frequency overshoot problem by removing the dependency on the second order power of the price. Although the filter copes relatively well at higher frequencies, we no longer have negative lag at the low frequency. Perhaps it would be nice to compare lag and magnitude gain of both filters across all frequencies to understand the actual differences.

Bookmark & Share
Mar 10
In the previous post I highlighted a wavelet based feature extraction model for financial time series. The intention was to use it as a starting point for developing an improved model. To start with let me explain what the model referred to in the previous post is meant to do.
There are two sections to the model. Common to both sections is a DWT smoother which is basically a lowpass filter. The first section analyses the smoothed volatility of the time series to determine the break points which they refer to as “variance change”. The second section performs FFT decomposition on the smoothed time series to obtain the dominant cycle. The trend and turning points are determined from the smoothed time series also.
Here is what I think about the model
- Firstly I don’t support the researchers’ choice of applying the Fourier Transform to determine the dominant cycle period. I explain in this post why FFTs should be avoided when analysing financial time series data. I am in favour of the Hilbert transform mainly for two reasons:
- The Hilbert transform works under the assumption that each price point has a phase difference to the previous and subsequant price points. This allows evaluation of the cycle length on a bar-by-bar basis, which unlike the FFT does not impose a constraint on the observation window length.
- The Hilbert transform provides a way of visualising interaction of short term cycles with longer term cycles on a phasor plot.
- What I wish to do is to replace the FFT part with the Hilbert Transform and another algorithm to determine the phasor plot of the actual time series - as shown below:

Bookmark & Share
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