Algominr Alpha 1.0 13

After some amazing community feedback, I decided to continue development on the algorithmic trading platform (for Forex). Here’s the new version. It should work on Windows 7 and 10. Mac and Linux support is underway.

Download

Link

Please contact us to get more information.

 

If you download it, you accept the Terms&Conditions and EULA (which limits my responsibility if you do something stupid). Please use this software only for research purposes.

This version includes:

  • Importing different instruments/forex pairs
  • Creating multiple strategies
  • A simplified visual-scripting tool to create the strategy logic
  • Different prediction/machine-learning modules: Linear/Logistic regression, LDA, SVC, Random Forests, Artificial neural networks
  • A backtester
  • A prediction tool

Come back to this page if you want to get a new version. Also, add your email on the right to get updates related to Algominr.

Video tutorial

How to use:

When executing the program you will be presented with a simple graphical user interface. If no recent project is found, a new project will be created for you.

blank_screen

First up, we need to bring some forex bar data into the project. You can import data by going to Import -> FX Bar Data.

Use the file browser to locate the CSV file of the currency you want to create a strategy for.

import

The currency bar data file should have 7 columns, representing: date, time, open price, high, low, close, volume and should be ordered such that the newest observations come last.

forex_data

You can get data for example from Meta Trader 4, click here to see how.

Once the data has been imported, you should click on the name of the imported instrumend on the left hand side. This shows the instrument view with a plot of the closing price, as well as the option to change the name, the average spread, and the frequency of the data. Setting the average spread correctly is highly important for the backtest to be valid, so please set a reasonable amount (for example 0.00013 if you trade EURUSD on Oanda). The refresh button will reload the file in case you update it.

instrument

 Now it’s time to create your first strategy. So click on the left Strategies tab and click on the Add Strategy button. This creates a very simple strategy from a template. When you click on the newly created strategy, you are presented with the strategy settings where you can name it, choose the instrument to trade, as well as setting the training and testing sample size. The training sample will be used to calibrate the strategy and the testing sample is used to control for over-fitting.

createstrategy

Once you are happy with the settings, click on the Logic tab to edit the trading strategy logic.

The logic view shows the structure of the strategy. It is a strongly simplified visual scripting tool. At the bottom of the logic tree you have data inputs (either bar prices or technical indicators) and at the top you have the trading node which generates trading signals. You can pan the logic plane by click-and-drag, should your tree grow too large.

strategylogic

Most nodes have a button to add(+) an input node, to change(o) the node, or to delete the node(x). You can create a wide variety of strategies with only these three functions. The strategy presented in the screen above shows the layout for a simple strategy where the return of the closing price is predicted by a linear prediction. It takes different technical indicators as features. The red line between the Lin Reg and the Return U/D node shows that the Return U/D node is the objective of the prediction.

To make the strategy work we will have to at least change the settings of the Return U/D node. So click on the middle button of the node (o) and you will presented with the following view:

changerud

The Return U/D node transforms the input signals into +1.0, 0.0, and -1.0. If the return of the input is larger than the threshold it will output 1.0,  if it is smaller than 1.0-threshold (e.g. 0.9999 in the above screenshot) it will return -1.0 and 0.0 otherwise. To make the strategy profitable, this threshold should at least cover the spread. In this example I set it to 0.0015, so we classify our returns into observations which are larger than 0.15%, -0.15%, and 0.0%. The shift defines how far into the future the return should be calculated. As we have 1 min observations in this example, we will change it to (around) 200. So, with these setting the node will output 1.0 if the return over the next 200 mins is larger than 0.15%, -1.0 if the return over the next 200 mins is smaller than -0.15% and zero otherwise.

This output is taken as the objective of the linear regression node. It will try to predict this output based on the technical indicators. So in plain words, it will predict if the return over the next 200mins is larger or smaller than 0.15%/-0.15%. Click on the Add button when you are done.

The last node we’re going to change before we test the strategy is the Market B/S node. It converts the output from the Linear regression node into an actual market buy or market sell signal.

marketbs

As the linear regression node’s output is continuous, we again define a threshold. Any input above this number will be treated as a buy signal, anything below the negative of this number will be treated as a sell signal. I set the threshold to 0.05. Any input above 0.05 will lead to a buy signal, any input below -0.05 will create a sell signal. The time out defines how long a position is to be hold at maximum. I set this to the same value as the Shift in the Return U/D node. If this would be much shorter than the Shift in the Return U/D node, trades would be closed before the predicted return is achieved.

So now it’s time to train the strategy. At the top (just to the right of the Logic tab) you can find the Train tab. If you click it, you will be presented with a blank screen with a single Train button. Click it. Now depending on how many observations you have and how demanding your strategy is, this can take a bit of time. This will train all the prediction nodes and conduct some basic back-tests. Once the calculations are done, a small report will be presented:

training

You can see the equity curve as well as different statistics for the strategy. If you scroll down, you will get the same information for the training sample. Now the strategy in this example is not very sophisticated and the results are of course very limited. It is up to you to find great strategies.

The last part we haven’t talked about is the last tab: Prediction.

If you click it, you will be presented with a very simple prediction screen. If you hit the start button, it will generate a prediction based on the last observation in the .csv file you have imported. If this .csv file gets updated, the prediction will also change. Please note, that at this stage, the prediction only continues to refresh if you stay in this tab. The prediction will also create a prediction file in the same location as the imported .csv file. You can use this prediction file and implemented in your favorite trading program. If you use MT4, please see bellow for a simple implementation.

Connecting to Metatrader 4

If you use MT4, you can directly connect Algominr to it. In the Algominr/MT4 folder you find a file called algominrMT4.ex4. If you place this file in the Metatrader 4/mql4/expers/ folder, you will find the algominrMT4 expert in your MT4 client. Look for Navigator/Experts. If you apply this expert to one of your charts, it will export the symbol’s data, which you can find in the Metatrader 4/mql4/files/ folder. The name of the exported file will be SYMBOL_FRQCY.csv, for example: EURUSD_1.csv. You can use this file in Algominr. If you then create a prediction, the prediction file will automatically be loaded by MT4 and the signal is displayed in the chart where the algominrMT4 expert is applied. Please note, that the predictions only get updated if you stay in the prediction tab in Algominr.

The expert will not generate any trades, but only make the information available directly in MT4.

Add you email to the email list to get updates about Algominr and new Tutorials on this site.

Leave a comment if you have any feature ideas, comments or bugs.


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.