Background
As a seasonal stock trader, it has been a dream for me to have a stock info system suggesting order price.
Traditional technical indicators do help me a lot for giving buy / sell signal most of the time, but would big data with applying machine learning techniques help me to capture every trading opportunities?
During the Easter holiday, I spent a few days for trying out using WEKA for stock price prediction.
Objective
To predicate day low and day high of the next trading day.
Choosing stock - 0002 CLP Power Hong Kong
Stock market: Hong Kong
Stock code: 0002
Stock name: CLP Power Hong Kong Limited
The CLP Group (Chinese: 中電集團) and its holding company, CLP Holdings Ltd (SEHK: 0002) (Chinese: 中電控股有限公司), is a Hong Kong electric company that has businesses in a number of Asian markets and Australia. It is one of the two main electric power generation companies in Hong Kong.
There are couple of reasons to pick CLP Power
- Sizable market cap
- Sizable trade volume per trading day
- Stable income
- Stable customer base (monopoly, the only electric power company in Kowloon and New Terror ties, covering over 85% of total Hong Kong population)
- Stable dividend scheme
- Stable government policy, less sensitive to political and financial issues
Feeding Weka- Preparing data files
I used Yahoo Finance as the data source for 4/Jan/2000 - 4/May/2017 (4504 records), and later normalize the data and adding technical indicators.
Be aware, Weka works with file in ARFF only. Read http://www.cs.waikato.ac.nz/ml/weka/arff.html for more.
WEKA comes with a ARFFViewer to read ARFF.
Data files:
Engine On
Open the "Explorer" |
Press "Open File" |
I pick 0002-COMPLETE.arff to predict change% of high on 5 May 2017. |
- The change percentage of lowest price;
- The change percentage of the highest price.
Either one has to be removed for processing.
i.e. If you wanted to predict the change of the highest price, remove the change of lowest price.
Go to "Classify" and choose "AutoWEKAClassifier" as classifier |
I gave 15 minutes to Weka to predict the change of highest price. |
Results
I got the result after the coffee break. Weka found the best classifier. |
And I scrolled down, there were the summary and the prediction result. The accuracy
seemed to be very disappointing. But when I looked deeper into the results, it might not be that bad as it seems.
Result files
I decided to put the prediction results into a trading simulation to see how it looks. It is the end of part 1.
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
DeleteGreat post! Thanks!
ReplyDeleteGreat post David,
ReplyDeletedid you get good results ?
Thanks!
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
ReplyDeletecan you share the logic to arrive at the technical indicators too please?
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete