Monday, 14 February 2011

A leading signal for oscillator indicators

It has been some time since my last post, the reason being the Christmas period and being busy working on non trading stuff. However, I am now back to work on the system and have been looking at creating a leading signal to avoid the pitfalls of indicator lag. Above is a snapshot of what I have come up with shown on a sine wave function (this leading indicator is for application to oscillator indicators).

The sinewave (in dark blue) is first smoothed by a FIR filter, sinewave smooth (in cyan), with filter coefficients such that this sinewave smooth has a constant lag at all frequencies. Knowing what this lag is, along with the frequency, the lag can be compensated for using mathematical and DSP theory to produce the lag adjusted sinewave smooth (in red). It can be seen that although the amplitude of the lag adjusted sinewave smooth is slightly attenuated, it is exactly in phase with the original signal. The lead signal 1 (in magenta) and lead signal 2 (in green) lines are leading signals 1 and 2 "points" (days, bars, candlesticks etc.) in advance of the original signal.

These signals are to be interpreted as follows
  • lead 2 crosses lead 1 exactly one "day" before the high or low, giving advance warning of the high or low
  • lead 1 crosses the lag adjusted sinewave smooth exactly on the high or low, acting as confirmation of the advance warning
Of course additional leading signals could be calculated to give a sort of countdown to the high or low as consecutive lines cross each other. All this will have to be tested on real data, but it is gratifying to see that the theory, and my coding of it, work flawlessly on idealised data. This testing on real data will be the subject of a future posting.

No comments: