Backtesting Your Binary Options Algorithms
Back-testing in the financial markets means to try out a particular strategy using historical events and conditions. There are several tools out there for the purpose of backtesting. To backtest a strategy, you will need historical data with which to setup your time frame charts, run your program under simulated conditions and the backtesting software will re-create how the software would have acted if the pre-programmed conditions were met.
After comparing the software’s performance with historical data, you’ll be able to detect if the software would have made profit or not.
In simple terms, backtesting is carried out by exposing your particular strategy algorithm to a stream of historical financial data, which leads to a set of trading signals. Each trade (which we will mean here to be a round-trip of two signals) will have an associated profit or loss. The accumulation of this profit/loss over the duration of your strategy backtest will lead to the total profit and loss.
Reasons for Backtesting
Some reasons why you would be smart to backtest your strategies:
Backtests are used to filter strategies so as to weed out what works and what does not.
Backtesting permits the use of certain market events to model software appropriately.
Backtesting is used to ensure that the performance of a strategy is at optimum levels.
Backtesting is used to verify that external strategies are working properly.
Backtesting can be used for algorithmic trading of binary options. These binary options algorithms are able to generate signals on third party software which can be transferred to binary options platforms for execution. There are a few of these software around that generate signals on MT4 and then bridge them over to web-based binary options platforms.
Software Used for Backtesting
Backtesting can now be done with several software solutions. In choosing the right software to backtest your algorithm, several considerations have to be made:
The skill of the programmer.
Broker compatibility
Customization functionality
Complexity of the strategy
Speed of Execution
Cost
Sourcing Data for Backtesting
Sourcing data for backtesting is the key component of the whole process. Without accurate data, anything else done in the backtesting process will be inaccurate. It is difficult to get access to accurate data that goes back at least 10 years, but for the purpose of modern day trading, data that dates back to 2007 (7 years) is something that the trader can make do with. The backtesting platform we have chosen is one which also goes to provide the source of the backtesting data. So traders can source data and conduct their backtests in one platform. The platform in question is that provided by the QuantConnect Corporation.
This firm offers backtesting facilities for trading algorithms, and provides data that dates back to 2007. QuantConnect offers traders free access to high resolution data for backtesting of trading algorithms on their trade simulator. Their backtesting facilities currently support US Equities and the forex market.
Unlike what is seen in many other backtesting platforms, the platform on QuantConnect provides fully interactive charts, allowing the backtest orders that would have been placed by your algorithm to be overlaid on these charts for better pictorial representation and analysis.
Backtests are completed in 30-60 seconds, which is way faster than what can be obtained from the MT4 platform. Traders can also build algorithms from scratch using this platform.
Graph of backtest performance. QuantConnect Corporation
On the right you can see the summary statistics we generate for your algorithms performance. It is critical to understand these and try to design a well rounded strategy. It is a common mistake to try and optimize the annual return, and the expense of taking large risks. A good investment has a low risk, and high return.
Data can also be sourced for MT4 backtesting, which is the easiest form of backtesting a binary options algorithm.
MT4 Backtesting
Backtesting on MT4 is done by using the Strategy Tester function. It is very important to obtain the data to be used for backtesting. This data is usually from the M1 charts. The M1 chart data is very hard to obtain, but can be accessed for selected currency pairs from this link .
To backtest on MT4, carry out these steps :
Freeze all current spreads by taking the MT4 trading platform offline. This is to prevent the results of the backtests being skewed by the conversion from 4-digit to 5-digit pricing.
Activate Navigator panel by clicking the Ctrl+N key. Then right-click on account under the Navigator panel, then click “Delete” to take MT4 offline.
The next step is to empty the shelf for the new downloaded backtest data to come in. This is by deleting existing history data. Go to the MT4 client, and open the history folder with its sub-directory, and delete all files with the *.hst suffix.
The next step is to download M1 Data. In case you missed it, go to // forextester/data/datasources. html and download M1 data for whichever currency pair you want to backtest. After downloading, use WinZip to unzip the file(s) to your desktop.
Now you should restart the MT4 platform and close the dialog box asking you to create a demo account or to log in with existing account details.
Click Ctrl+O or click on Tools à Options à Charts, and add 999999999 to change the max bars in history. This is to make allowance for the incoming M1 data.
Press F2 to activate the History Center, and double click on the 1 minute timeframe to make sure there is not any existing data.
Click “Import” to launch the Import dialog, and use the “Browse” button to navigate through the unzipped M1 data already downloaded. Click OK to import the data.
Repeat the entire process for all currency pairs you would like to backtest. When all history files have been imported, shut down MT4 and allow the history file(s) to be imported fully. Then convert the M1 data to other time frames.
Convert the M1 Data to work on other time frames so that you can backtest on them as well. To convert the M1 data so that it can be used to backtest the strategy on other time frames, launch MT4, and again cancel out of all prompts. Open an M1 chart with the currency pair whose M1 data is to be converted.
From the Navigator tab under Scripts, drag the Auto_converter script on to the chart. The script should show the conversion for 5 minutes, 15 minutes, 30 minutes, 60 minutes (1 hour), 240 minutes (4 hour) and then 1440 minutes (daily) charts.
Conclusion
With the facilities provided by QuantConnect Corporation and Metaquotes Inc (MT4), traders in the binary options market can run backtests on their trading algorithms. The MT4 can be used for simplified versions of the algorithms while more complex work can be done with the QuantConnect interface.