Software tools to predict market movements using convolutional neural networks.
The basic idea is encode market data as RGB pixels for train CNN to predict market movements and detect patterns. CNN framework caffe was used.
Good results was observed training the CNN to detect when the price will drop 20 pips in next 60 minutes. In CNN top 10 positions detected in ~7 days, we observe ~70% correct predictions, ~10% incorrect prediction, ~20% neutral predictions (not profit loss).
Current software only analyze USDJPY
but it was code to be adapted easy to any trade item.
- python3.5
- caffe framework with python3.5 bindings
- pip install -r requirements.txt
- Adjust database settings at file
settings.py
. - Run command
python models.py
to create required table at database.
python downloader.py
This command will start the download of historical data (forexite.com is used) for the past 12
days. The script can be modified easy to allow download more data.
Under folder data/forexite/
all the market data downloaded will be stored.
After download the data we need load it to local database, this is done by a single command.
python multicore_tasks.py csv data/forexite/
This research cover 4 distinct ways to train the CNN according to 4 similar CNN Net. Is recommended train the CNN with less than 1 month of data in current software.
To create the train and test file run this command python lmdb_processor_bin2.py build
, adjust lmdb_processor
script with the correct estimate of images that will be generated and the dates ranges.
bin_test_lmdb
this is the testing setbin_train_lmdb
this is the training set
At repo under folder caffe_trainer/
is located the caffe Nets used to generate the trained CNN.
- Adjust
lmdb_processor_
script to load use the trained CNN. - Run predictor
python lmdb_processor_bin2.py predict
SELL For top 10 (top 20%), we see this good results: profit: 60% positive money profit. 70% positive, 10% negative, 20% real neutrals For top 25 (top 50%), we see yet ~25% profit.
SELL 60% positive, 0% negative 40% real neutrals profit: ~60%
For top 25 (top 50%), we see yet ~30% profit.
BUY** 80% positive, 20% negative profit: ~60% For top 25 (top 50%), we see same 80% positive, 60% profit
BUY positive: 80% negative: 20% profit: 60% For top 25 (top 50%), we see 16ok, 9ko, ~25% profit yet
SELL if inverted profit ~100%, For top 25 (top 50%), we see good accuracy. (non-sense here)
Case buy, sell, undef >20 pips in 60 minutes (diff prob buy-sell, sell-buy) was the best predictor for SELL positions(60% profit). Profit decrease here to 30% using top 25(50%). Case binary buy, sell after 60 minutes, was the best predictor for BUY positions(60% profit remain using top 10 and top 25).
While this reasearch aparently show good result at studied time frame, the best pattern was not observed again. And same study at distict time frames change the results. Then this ends just as a complex gamble game.