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.
Please contact us to get more information.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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:
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.