Updated 12 Apr 2018
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)
Kawee Numpacharoen (2020). Files for webinar titled "Classifying Trading Signals using Machine Learning and Deep Learning" (https://www.mathworks.com/matlabcentral/fileexchange/66045-files-for-webinar-titled-classifying-trading-signals-using-machine-learning-and-deep-learning), MATLAB Central File Exchange. Retrieved .
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.
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.
Unfortunately, your request is something that I am not allowed to do.
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.
Re: Antonio Alvarez....I suggest re-running without the normalization in the Partition. Good Luck
Sorry for the delated answer. I've just seen the question. You can get the training data by running the following files, respectively.
hi, can you also include the data training ?
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.
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?
ok. solved it. I should run data1_Retrieving at first
The webinar is not available yet. This code is for a future webinar(Apr 2018),
Can you provide a link to the webinar? I can't find it
Adjust the standardization process for Demo3