HOW TO INSTALL AMIBROKER TURNKEY CODE
Turnkey Code instructions: In these short videos we will show you how to install the Amibroker Turnkey Code and run a simple backtest.
TOOLS
- Amibroker
- A data source. We use and recommend Norgate Data.
- Turnkey Code
INSTRUCTIONS
1. Saving AFL Files
2. Accessing the Source Code
3. Running Signal Explorations
4. Running a Backtest
5. Inserting a Chart
TEXT VERSION
1. Saving AFL Files
I’m going to show you where to place the files that you will receive after buying the Turnkey code. It’s important that the files get placed into the right folder, so they’re easily accessible when you actually open Amibroker. So the two files you will receive, one is an AFL file, and one is an instruction file. Both can go in the same folder and be accessible from that point.
We go into the C drive / program files / Amibroker folder / formula folder, and within the formula folder, create your own and call it after any particular strategy. That way it’s easily accessible once we open Amibroker.
To access a file through Amibroker, open your Amibroker, select the analysis window, then on the right-hand side, select a file. Store your different systems here. If we double-click on a strategy, that code is now loaded and you can see it loaded in the formula window.
2. Accessing the Source Code
You should only tinker with the source code if you make a backup copy of the original code. If you do wish to change any of the default settings, you will need to do that in the source code itself.
There’s two ways to access the source code.
In video 1, we showed you how to load the formula, through AmiBroker itself. So that formula is currently loaded. Now to access the source code, we click on a little Code button on the right and that will bring up the source code and then you can go and make any changes as required.
But, if you do intend to make changes, make sure you make a backup copy of the source code first.
The other way to access the code is via Analysis / Formula Editor, and we use the dropdown menu to open. You can navigate your way through your different codes, etc.
3. Running Signal Explorations
We’re going to run explorations to generate signals and to do this, we open up our analyzer. We then select the code that we want. In this case, we’ll select the Day Trade system again.
We need to ensure that periodicity of the system is in the analysis settings. So, the Day Trade strategy runs on daily data. If you’re trading the Weekend Trend Trader, then you would change this tool to weekly.
Then we go down to the date range. We can select one recent bar or one recent day and that will ensure it will just generate signals for the last bar. Make sure your data has been updated.
We then select the filter of the universe we wish to trade. In this case, the Day Trade system trades the Russell 1000. Now ensure that you select the Russell 1000 and not the Russell 1000 Current and Past. We only want the current constituents of the Russell 1000. Select, okay.
We will then take a look at the parameters. You can select an account balance in here. So if your account balance is $68,000. You would put 68,000 in there. Default setting is 10% per allocation. Now you might trade a little bit more conservatively and put 5% in there.
There are three outputs: The regular signals, Chartist API formatted signals, and the Interactive Brokers DDE formatted signals. We’ll use the regular one to start with, select okay, and then the explore button.
Do not use scan, we must use explore because it is looking for the criteria in our specific code.
So we select explore, and Amibroker will run through the current list of the Russell 1000 stocks and look for the broad signals that are recommended for the following day and these orders would then be placed.
Let’s change that now to the Chartist API output. And again, we hit explore to calculate our position sizing based on the account capital that we put in there, which was $68,000, so it’s calculating the quantity we buy, and it is also formatting the order sheet, which will then be uploaded to the Chartist API.
It will do the same thing for the Interactive Brokers DDE application. And depending on which one you’re running would be the one that you use.
4. Running a Backtest
Ensure you have your code loaded into the analyzer. Then set up parameters up correctly. These are the default parameters. So, we’ll run with those. You can make any changes to those to suit your own needs and requirements. The next thing to do is set your dates. And when we ran, in the last video, the signals, we chose one recent day. But, for a backtest, we’re going to select from/to dates and we’re going to use these two windows. I’ll run from 2010 up through 2020.
Then select the universe. And we want to include the past constituents. So here we’re going to choose the Russell 1000 current and past. (total of 3204 symbols).
The next thing we need to do is go into settings. This is where we control our margin and we also control our commissions. So, commissions are in here these are the default Interactive Broker commissions. The Day Trade System in this particular instance, I’m going to run it on a 25% LVR, which is the Pattern Day Trader rate. You can change that if you want to be a little bit more conservative.
And with that all set, we select the Backtest button. And depending on the universe that your backtesting on and the period of time, will depend on how long that will actually take.
With the Backtest completed you can see the trades listed from the start date through to the end date. On the left hand side you can see some of the symbols have a date on the end – these are de-listed stocks. That’s how we get accurate backtesting without any of the survivorship bias.
5. Inserting a Chart
Now we want to insert a chart to have a look at the signals. And to do that we hit the little X to open a new blank chart. Over on the left hand side, we can select the different strategies, say the Mean Reversion Strategy. We right click to insert. We can then right click to remove the top pane.
The chart will show buy and sell signals. We can then go through and have a look. For example, where buy and sell signals are. The green arrows mean there is a signal generated but no trade actually filled. An exit signal is shown by the red arrow. So that’s how we insert a chart. If you’re trading on weeklies, such as the Weekend Trend Trader, then ensure that your periodicity here on the chart is actually a weekly and not a daily.