File Exchange

image thumbnail

Files for webinar titled "Classifying Trading Signals using Machine Learning and Deep Learning"

version 1.1.0.0 (1.44 MB) by Kawee Numpacharoen
You will learn how to classify trading signals into "buy" or "sell" using machine/deep learning

29 Downloads

Updated 12 Apr 2018

View License

Using the stock index data, we will show how to perform:
- Data preprocessing, factor creation, and data partitioning
- Rule-based trading (Demo1)
- Classifying trading signals using Classification Learner App (Demo2)
- Classifying trading signals using LSTM (Demo3)

Comments and Ratings (16)

Hi Giovanni,

What you describe in the comment is a combination of rule-based trading. I think you can use machine / deep learning to generate signal using 7 days returns (as a response variable). But, you may need to back-test with your rules on holding period later. The latter must be done on a back-testing framework.

Best,
Kawee

Hello Kawee,
I really enjoyed the submission.
I tried with no much success to modify the program to generate a response variable that, assuming that we could buy at the end of the trading period when the signal is generated, is a Buy if the returns>0 at the end of any of the next N trading periods, and it is a Sell if the returns<0 at the end of any of the next N trading periods, where N=7 for example. In the demo provided N=1 and I am trying to generalize it. Would you be able to help?

Thanks Kawee. There is a solution, but probably too much work...change the end date from Dec.31 2017 to today and re run the demo script! Thanks anyway.

Hi Giovanni,
Unfortunately, your request is something that I am not allowed to do.
Best,

Hello Kawee,
really great demo. In order to reproduce the results, it would be great if you could upload the original data1.mat file because fred does not go back now to Feb.29, 2008 which was available at the time of the webinar and it was 3652 days before the end date of Dec.31, 2017 in the demo. It only goes back to Apr.30, 2009.
Thanks

Gregory

Re: Antonio Alvarez....I suggest re-running without the normalization in the Partition. Good Luck

cjx

Sorry for the delated answer. I've just seen the question. You can get the training data by running the following files, respectively.
1. data1_Retrieving.mlx
2. data2_Preprocessing.mlx
3. data3_Partitioning.mlx

hi, can you also include the data training ?

Hi Antonio,

First of all, the demos are mainly designed to show how to create simple models. Although you have used open, high, low, and close, these 4 variables are originally derived from the price. In short, it's not easy to build a good predictive model from price data alone. Data plays a very important role in modeling.

Best,
Kawee

I forgot to say that I'm using month, day of the month, day of the week, hour, open, high, low and close 1 minute values as input data. It's a total of, more or less, 4,500,000 x 8 values for training.

I have been trying to train an LSTM network. I'm using last ten years of EUR/USD data and I get results similar to yours, with a 50% accuracy, that is the same that classify randomly.
I've tried adam and sgdm, with learning rates from 1 to 1d-9. I'm normalizing the data, randomizing it and using the same amount of "buy" and "sell" training responses, I've also tried with different batch sizes and number of layers and cell units.
I'm starting to think that it's not possible to train a network with a good accuracy, but since this is the first LSTM network I train, I don't know if I'm doing something wrong.

Have you been able to achieve a good precision?

ye shan

ok. solved it. I should run data1_Retrieving at first

Hi Nick,

The webinar is not available yet. This code is for a future webinar(Apr 2018),

Best,
Kawee

Nick

Can you provide a link to the webinar? I can't find it

Updates

1.1.0.0

Adjust the standardization process for Demo3

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux