Saturday, 19 February 2011

A leading signal for oscillators #2



I have now completed coding of the leading oscillator signal (c++ .oct file) and shown above are the results.

The topmost chart shows idealised prices as a combination of trend and sine wave with the highpass filter below. Lead 1 and lead 2 are the 1 and 2 period leading signals of the original "price" in blue and the highpass filter in black (see legend in the plot).

The second chart shows the same, but with no trend component added to the "price." Plotting this way makes it easier to see that the indicator lines are exactly in phase with "price" and its leads.

The last chart is a check of my algorithm coding. Applying the highpass filter, and then smoothing it, results in various degrees of phase lag or lead in the basic indicator, dependent upon the period of the underlying signal. Using Monte Carlo techniques to determine the lag/lead at periods of interest I have adjusted the phase of the final indicator outputs such that the indicator adapts to the amount of lag/lead by applying a phase correction. This final chart is just a check of this phase correcting algorithm. As can be seen, once the algorithm calculations settle down, the algorithm correctly calculates the lag/lead to apply as evidenced by the hp_sine values completely overwriting the original "price" values. This algorithm is used in the .oct function used to create the top two charts of the highpass filter.

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.

Thursday, 16 December 2010

Bayesian Analysis Update

Having spent the last 6-8 weeks researching and trying out various coding attempts, I've come to the conclusion that, for the moment at least, my time will be spent more usefully doing some of the other things on my to do list. Bayesian analysis is on the back burner for the nearest future.

Wednesday, 13 October 2010

Bayesian Analysis

The thing I'm working on at the moment is applying Bayesian analysis techniques to the trading system, and I'm currently in the research phase consisting of lots of reading and occasional queries to on-line statistical forums. The idea behind this is to develop a methodology to switch between different sets of trading rules, each rule set being applicable to defined market types. More on this as and when I have something relevant to report.

Friday, 8 October 2010

Posting to another forum

Readers of this blog might be interested in a recent forum posting of mine here, under babelproofreader.

Tuesday, 21 September 2010

Recent coding work

Have been working on the various .oct compiled functions and am happy to say that the work on MC re-optimisation of .oct functions for ucl & lcl for price, cybercycle, fisher transformed cybercycle, cybercylce relative to price bars and fisher transformed highpass filter has now been completed and the "to do page" updated accordingly.

Sunday, 19 September 2010

Update on First Trades

The Feeder Cattle trade has been stopped out for a loss in both the Collective2 account and the live trading account. However, the EURCAD forex trade remains open and is showing an open profit of $1602 (on Sunday evening before the markets open) in the Collective2 account. The EURCAD trade was not taken in the live account because the risk was too great for the account size.