AlgoMinr – First post 9


Description

NEW VERSION HERE

 

This is a simple implementation of a data miner for traders with a graphical user interface. It is mostly aimed at forex traders but can be used to predict any time series. It classifies the future price into buy, hold, or sell. To do this, four simple machine learning methods are implemented:

Linear regression

Logistic regression

Linear discriminant analysis

Support vector classification

The features of the models are different technical trading indicators as well as principal components derived from them. The methods are based on the scikit-learn library. The implementation follows a walk-forward optimization scheme.

I developed the basic version for a client who ended up going into another direction. Therefore I have the permission to release this little tool to the public. I hope I can help some people with their trading.

Download (86.3MB, Windows):

Link expired

How to use:

Once you have downloaded and unpacked the .zip file, please run the AlgoMinr.exe file. Please give the program some time to open up, it is loading many libraries. After a little while, the following GUI will open:

screen1

Please note, that a console window gets open up as well, where additional information is displayed. What we need to do first, is load some data to work with. It takes simple .csv files where the first column shows the time stamps and the second column contains the mid-price. See this screen if it isn’t clear.

The folder where AlgoMinr.exe is located also contains a folder “data”. It contains an example “.csv” file.

In the GUI, please click on “Load file” and navigate to this folder. (Please note, to open a folder, a single-click is sufficient) and load “input.csv”.

Now you have to specify the periodicity of the loaded file. Please set it to 1 hour if you are using the example file provided.

4

You can now hit the “Run” button in the top right corner. It will take a while to train and test the models, but after a short while you should get the results on the right side of the window.

5

The top part shows the accuracy of each predictor in the most recent testing window. In the example screenshot, LDA predicted 61 percent of the time the correct price movement. If we assume that there is some stationarity in the forex time series, we expect this to be the best predictor for the next prediction.

The lower part shows the predictions for the next observation (meaning the one following the last observation in the data file). As training sometimes can take quite a bit of time, you can use the models to make a new prediction by loading an up-to-date data file and clicking on the “Make prediction” button. This will only apply the trained models to the new data and might be helpful in deciding on a discretionary trade.

6

Please let me know if you have any critique or questions in the comments. Would you like to have further features?

Additional information

The walk-forward optimization uses a training and a testing window. Initially, the predictors are trained for X training days and then tested on Y testing days. Once this is done, both windows are rolled forward by Y days and the process is repeated. The results of this operation can be found in the console window that is opened when starting the AlgoMinr application. Additionally, the folder containing AlgoMinr.exe will also contain a results.csv file which lists the accuracy of each predictor for the different windows. This can help to see if there is any kind of stability in the results.

7

The slider “Prediction time”, defines how far into the future the prediction should be. So if the frequency of the data is 5min and the “Prediction time” is 5, the classifiers will look 25mins into the future.

The slider “Train size (days)” shows the number of days each training cycle should be.

The slider “Test size (days)” shows the number of days each training cycle should be. If the training size plus the testing size are too large for multiple cycles, only one cycle is performed. Be careful, however, if the sum is larger than what is available in the input file, an error occurs and the program will terminate.

The input slider define the look-back windows for the different technical indicators. You can test which sizes work best for you.

The tick box at the bottom “Use non-linear transformations” is highly experimental and should probably not be used. It creates non-linear transformations from the technical indicators. This extends the feature space by several hundred inputs. Most of the time, this will only lead to overfitting and the accuracy in the testing windows suffers. Additionally, the large feature space slows down the training process significantly.

The models and their parameters are saved to the hard-disk. So they will be available on the next start up of the program. If you only want to make a prediction, specify the new .csv file and hit the “Make prediction” button.

If the .csv file gets updated, you do not need to search for it again, with the load button. The program will just use the new data.

Errors

Training and testing windows to large for data file…

This error appears if the training and testing windows are too large for the specified file. Please also make sure that you specified the right periodicity of your data, as otherwise the training size and testing size are not calculated in the correct way.


Leave a comment

Your email address will not be published. Required fields are marked *

9 thoughts on “AlgoMinr – First post

  • NewNine

    Let me first thank you for your work and your generosity in releasing your application to traders at large. I’m new to the field of algo-defined trading bit definitely willing to explore. I see your program as a good starting point but I’m wondering how exactly do you use it in live trading? I mean, is it possible to get entries & exits via the interface, or is its overall purpose primarily to indicate trend direction? A simple example or case study of an actual trade would be helpful. Thanks and regards.

    • admin Post author

      There’s no fixed entry/exit system at the moment. The machine learning models just predict the movement of the price. If that movement covers the trading cost (1% of the position atm) it will create a buy/sell signal.

      I guess at the moment it can just help you in your discretionary trading decision process. I’m currently planning on extending the system quite a bit.

      Maybe I can even do a metatrader integration if people require that.

  • Frank

    Hello. I’ve been trying to test out the program but I can’t seem to get any data other than your example to work with it, I keep getting an IndexError: list index out of range, no matter how many rows I have in the CSV. I’ve formatted everything perfectly the same I believe. Could you possibly lend a hand? It did not help when I formatted to 4 decimals either.

    Example:
    Date (GMT);Last
    04.01.2015 23:57;1.19421
    04.01.2015 23:58;1.19420
    04.01.2015 23:59;1.19410
    05.01.2015;1.19391
    05.01.2015 00:01;1.19405
    05.01.2015 00:02;1.19389
    05.01.2015 00:03;1.19390
    05.01.2015 00:04;1.19411

    • admin Post author

      Can you try replacing the semicolons “;” with commas “,”? Im currently working on a new version which will help with many of the issues.

  • Anton

    ValueError: all the input array dimensions except for the concatenation axis must match exactly
    What is wrong with my test data?

    Date (GMT);Last
    02.01.2015 09:00;1.20538
    02.01.2015 10:00;1.20554
    02.01.2015 11:00;1.20467
    02.01.2015 12:00;1.20574
    02.01.2015 13:00;1.20503
    02.01.2015 14:00;1.20531
    02.01.2015 15:00;1.20377
    02.01.2015 16:00;1.20301
    02.01.2015 17:00;1.20146
    02.01.2015 18:00;1.20309
    02.01.2015 19:00;1.20133
    02.01.2015 20:00;1.20093
    02.01.2015 21:00;1.20114
    02.01.2015 22:00;1.20051
    02.01.2015 23:00;1.20030
    05.01.2015 00:00;1.19454
    05.01.2015 01:00;1.19451
    05.01.2015 02:00;1.19465
    05.01.2015 03:00;1.19623
    05.01.2015 04:00;1.19543
    05.01.2015 05:00;1.19556
    05.01.2015 06:00;1.19435
    05.01.2015 07:00;1.19405
    05.01.2015 08:00;1.19343
    05.01.2015 09:00;1.19469
    05.01.2015 10:00;1.19558
    05.01.2015 11:00;1.19548
    05.01.2015 12:00;1.19538
    05.01.2015 13:00;1.19199
    05.01.2015 14:00;1.19047
    05.01.2015 15:00;1.18991
    05.01.2015 16:00;1.19125
    05.01.2015 17:00;1.19334
    05.01.2015 18:00;1.19361
    05.01.2015 19:00;1.19173
    05.01.2015 20:00;1.19228
    05.01.2015 21:00;1.19338
    05.01.2015 22:00;1.19382
    05.01.2015 23:00;1.19361

    • admin Post author

      Great, happy you solved it.

      Did it require an empty line to make it work? That is strange. Come back for a new version very soon. It’s going to allow for some very simple visual scripting. 🙂

    • admin Post author

      Hi Mole,

      hm, I’m not sure what causes this. Most of the scanners don’t detect anything, but I will try to figure it out.

      Thanks for pointing it out to me!
      Chris