Thursday, 6 June 2013

First Version of Neural Net System Complete

I am pleased to say that my first NN "system" has now been sufficiently trained to subject it to testing. The system consists of my NN classifier, as mentioned in previous posts, along with a "directional" NN to indicate a long, short or neutral position bias. There are 205 separate NNs, 41 "classifying" NNs for measured cyclic periods of 10 to 50 inclusive, and for each period 5 "directional" NNs have been trained. The way these work is:
  • at each new bar the current dominant cycle period is measured, e.g 25 bars
  • the "classifying" NN for period 25 is then run to determine the current "market mode," which will be one of my 5 postulated market types
  • the "directional" NN for period 25 and the identified "market mode" is then run to assign a "position bias" for the most recent bar
With a total of 205 NNs to train, it has taken me a few months of almost continuous computer time to reach this stage. Each NN initially went through unsupervised training via a Restricted Boltzmann Machine and then training with labelled data via a Feedforward neural network. Although not strictly necessary Early stopping was employed with a target of less than 5 % classification error rate for training, validation and test data. The split of all data available was 80 % to training, 16 % to validation and 4 % to test.

Below are shown some recent charts showing the "position bias" that results from the above. Blue is long, red is short and white is neutral.
S & P 500
Gold
Treasury Bonds
Dollar Index
West Texas Oil
World Sugar
I intend these "position biases" to be a set up condition for use with a specific entry and exit logic. I now need to code this up and test it. The test I have in mind is a Monte Carlo Permutation test, which is nicely discussed in the Permutation Training section (page 306 onwards) in the Tutorial PDF available from the downloads page on the TSSB page

I would stress that this is a first implementation of my NN trading system and I fully expect that it could be improved. However, before I undertake any more development I want to be sure that I am on the right track. My future work flow will be something like this:-
  • code the above mentioned entry and exit logic
  • code the MC test routine and conduct tests
  • if these MC tests show promise, rewrite my Octave NN training code in C++ .oct code to speed up the NN training
  • improve the classification NNs by increasing/varying the amount of training data, and possibly introducing new discriminant features
  • do the same with the directional NNs
More about all this in future posts.

No comments: