Regular visitors will have noticed ever increasing amounts of spam on the Trading Gurus Community Forum. On November 24th 2012 we implemented some changes:

1. New users will be moderated 2. Registered users who have a post count of zero will not be able to view attachments or download code. 3. Registered users who have a post count of zero will not be able to create a new thread

As an additional countermeasure we anticipate introducing a modest paywall in the near future.

If this is your first visit here our apologies for the inconvenience.

Existing users may wish to contribute their ideas to this thread.

Page 4 of 4 FirstFirst ... 234
Results 31 to 40 of 40

Thread: Trading using Support Vector Classification

  1. #31
    Senior Member
    Join Date
    Dec 2011
    Location
    London, UK
    Posts
    139

    Pseudo Random Numbers

    I've just written a quick dll that uses the Mersenne Twister code from here. The library generates its own seed from the system clock which should avoid the repeatable random numbers generated in MT4 backtests. I've written an example EA that shows how to call the library too.

    I haven't tested this at all, except to see that random looking numbers are output!

    Now we can use random numbers in backtests, independently of the modelled system time.

    Cheers,

    Dr T
    Attached Files Attached Files

  2. #32
    Junior Member
    Join Date
    Feb 2011
    Location
    London
    Posts
    15
    Quote Originally Posted by Dr_T View Post
    I notice that the aforementioned MT5 EA takes indicators as inputs. Something that has been mentioned in numerous pieces of academic literature is that pooling AI committees can also make improvements to both profitability and smoothness of the balance curve. I don't have references to hand, but will post them when I come across them again. I may have posted some earlier in this thread. Anyway, the point of mentioning this is that another thought that has been rumbling around my head for a while is that it might be worthwhile using committees that incorporate various inputs, from raw ticks to bars to indicators.
    I found your idea of using log returns more interesting. If by committees you mean more than one input, perhaps log returns from different assets can be worth trying.

    I posted a very basic introduction to Genetic Programming in the new thread. Thank you very much for sharing your code, I am not a programmer so modifications are quite beyond my skill, but I'll try to use it to experiment with binary options. I am also trying to optimize v1_20120417 with lower StopLoss/ProfitTarget. Can I ask how TrainingRange parameter is different from Ntrain? As I understand, TrainingSpread represents spread for paper trading?

    Cheers

    Matka
    eternity in an hour

  3. #33
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Hi all,
    First of all thanks for all the useful information in this thread.

    I've been experimenting with SVMs using Jforex platform for a while. My aim is to create a day trading system with fixed stop loss and take profit. So no complicated exit strategy for now. SVM will decide whether it is a BUY or SELL signal at the beginning of each day.

    So far so good, I've created some data in libsvm format for EURUSD starting from 2007 until sep 2012, mixed it up and created two different train/test datasets. Optimised and trained my SVM. When it comes to backtesting it shows some really promising profits/win ratios.

    My problem/question is when I backtest it on between sep 2012 and now it fails to show same results. Is it the nature of SVMs ? I guess because it has never seen the data between sep-jan it fails to show same results.

    I am not really confident about the mathematical background of SVMs as a software developer I've been using it for a while as a practical tool in my other hobby project so please forgive me If this was a nonsense question.

    Thanks.

  4. #34
    Senior Member
    Join Date
    Dec 2011
    Location
    London, UK
    Posts
    139
    Quote Originally Posted by attollos View Post
    Hi all,
    I've been experimenting with SVMs using Jforex platform for a while. My aim is to create a day trading system with fixed stop loss and take profit. So no complicated exit strategy for now. SVM will decide whether it is a BUY or SELL signal at the beginning of each day.
    Sounds great. Jforex is pretty handy for libsvm, since there is a nice Java implementation, so no need to mess around with wrapper libraries - it's also nice because Java is cross-platform, so I could play at trading using Linux too! I did something similar to what you describe last year (see one version attached if it is of interest), although I haven't gone back to JForex for a while... mainly because it looked like opening a Dukascopy account could get a bit more involved than other retail brokers... in the UK at least. However, their spreads are quite attractive, and I wonder if it might be easier to be profitable... although they add commission charges on top, so swings and roundabouts!

    My problem/question is when I backtest it on between sep 2012 and now it fails to show same results. Is it the nature of SVMs ? I guess because it has never seen the data between sep-jan it fails to show same results.
    A bit more information would be helpful here. Perhaps you could post some results and details. If you are willing to share your code, then others may be able to see if they can re-produce your findings.

    Is the failure occurring once you have completed training and test out of sample? If so, it's likely that the SVM has produced a curve fit and is not generalising. There could be several causes for this. It may be that the underlying input data has no predictive power, so the SVM can classify (or do regression) on the training data, but outside of the training set you simply get effectively random trades. However, it is equally possible that the data does have predictive power, but you are doing your walk-forward testing using the optimal in-sample SVM paramters (cost, complexity etc). I've tended to find that the best parameters during training do not reflect the best walk forward tests. I do a simple grid search of the parameter space and use a pretty wide search area... so it takes a long time to complete.

    For example, I have a trend based system that seems to have an edge, but is not able to beat the spread (code will follow one day). I'm trying to get an SVM to learn the characteristics of the time-series that tend to result in large losses. The principle is that if I can eliminate such losses, then the system could actually trade profitably. I've found that the most successful walk-forward SVM uses a cost parameter of something like 10^50 and complexity of 10^-12. In fact, the parameter space produces a very narrow range of usable values (see attached screengrabSVM Optimisation.png)... this is still a work in progress, so don't read too much into it!

    (Edit: The rectangular greyscale image within the Mathcad worksheet represents the system's balance as a function of SVM parameter, cost is vertical and complexity horizontal. White is the highest profit gained and the shade of grey darkens as the final balance decreases. Note the adjacent graph shows the filtered system with a red line and the original balance curve in blue. This particular subset of the data is for the largest and most extended drawdown in the original dataset.)

    Anyway, whatever the cause, it's a very valid question.

    Cheers,
    Dr T
    Attached Files Attached Files
    Last edited by Dr_T; 01-08-2013 at 12:51 PM.

  5. #35
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks for quick reply and information Dr T. Let me detail my strategy:

    1) Using the Jforex platform history service I've created a classification dataset in libsvm format, which probably contains more than 10000 features (from time series to technical and signal analysis data with different params).
    2) Shuffled this data and divided into two: test and train
    3) Implemented a small genetic/evolutionary optimization framework for feature selection and C and gamma parameters selection for my RBF kernel. Basically each evolution of my algorithm trains and tests a SVM with different C,gamma and feature selections. This framework tries to maximize both train and test accuracy.
    4) A few weeks of optimization later accuracy of test dataset was around ~%75.
    5) This has been done for both bid and ask side.
    6) Simple daily trading strategy with static stop loss and take profit which does very well in backtesting.(I can attach some graphs later)

    However it fails to repeat the same results If I test it for the last couple of months. I was thinking my the problem is shuffling my data set which means basically my back testing data is a mix of train and test svm data which is not the case for last couple of months.

    Thanks.

  6. #36
    Junior Member
    Join Date
    Feb 2011
    Location
    London
    Posts
    15
    Hi Attollos,

    Perhaps you over-fitted because emphasis was to much on finding the best parameters for the testing part of the data? (still kind of in-sample if I understand your data division properly).

    Cheers

    Matka
    eternity in an hour

  7. #37
    Senior Member
    Join Date
    Dec 2011
    Location
    London, UK
    Posts
    139
    Quote Originally Posted by attollos View Post
    I was thinking my the problem is shuffling my data set which means basically my back testing data is a mix of train and test svm data which is not the case for last couple of months.
    Hi Attollos,
    Sounds like the likely culprit. Can you give a few more details about your shuffling protocol?

  8. #38
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494

    Modeling high-frequency limit order book dynamics with support vector machines

    A new academic paper has been published on the above topic:

    http://www.math.fsu.edu/~aluffi/archive/paper462.pdf

    The machine learning modeling method described in this paper provides a framework to automate the prediction process for limit order book dynamics in real time. Treating prediction of various metrics as a supervised learning problem, our method first reduces the problem at hand into a set of binary classification tasks and then builds multi-class models by using SVMs for each binary task.

    To improve the efficiency in training models and labeling unseen samples, features are selected according to information gain so that only those attributes significantly contributing to the performance of the resulting model are retained. The validity and robustness of models are verified with a n-fold cross-validation process that evaluates model performance in terms of precision, recall and F1 -measure.
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  9. #39
    Junior Member
    Join Date
    Dec 2014
    Posts
    2
    Hi
    i have some question
    1= your wrapper work with new libsvm?
    2= did you test other toolbox for SVM?
    3= what you give to svm for output ?
    4= how you optimize the parameter of kernel ?
    best

  10. #40
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Hi
    After more than 2 years, have you got results with neural networks ?
    Regards

Page 4 of 4 FirstFirst ... 234

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •