Anal porno
- Anal porno
How to Conduct Backtests on MT4
  • How to Conduct Backtests on MT4

    Author: 

    posts: 123, comments: 1

    Backtesting in MT4

    Image source www.usatoday.com

    One of the questions that many traders and MQL programmers ask today is how to conduct accurate backtests of the software that they create and use on the MT4 platform. In today’s article, we will talk about the process of backtesting data on the MT4 platform. Backtesting of data is usually done to check the efficacy of expert advisors and take a look at their theoretical historical performance.

    Backtesting simply answers the question: how would the EA have performed if it had been used to trade a particular amount of money on a particular currency? Would it have increased the account size or would it have reduced it? Backtesting therefore borders on efficacy.

    Testing a strategy on which a MetaTrader4 expert advisor is built on requires that its performance over a specific historical time period be done, and fortunately the MT4 platform is built not only to run with expert advisors but also has facilities for backtesting using the Strategy Tester function (Ctrl + R). The issue with this process is that if the trader just downloaded the platform recently before use, the data that will be supplied will only be as good as the date of download. Backtests are usually done over a long period of time (sometimes up to 10 years). This would mean that only traders with platforms downloaded in 2003 would have complete, functional data for backtesting purposes.

    Backtesting requires good quality data that has at least 90% quality. The solution would therefore be to source the data for backtesting from other sources with a complete set of data that lasts at least 10 years. Let us now go through the process of correct backtesting of an EA using MT4 data.

    Step 1
    You cannot start a backtesting process without a good MT4 client. One of the best sources for such a platform would be to download the MT4 platform of E-Global Trade and Finance Corp. This platform is available on their website. Alternatively, you can use this link. Download the application and install it into a separate folder on your hard disk drive. Make sure your PC has at least 2GB of unused hard disk storage as the data that will be downloaded in the next step takes up a lot of space.

    Step 2
    Run the MetaTrader4 executable file, and use the pop-up box that opens after full installation to open a new demo account, then close all open charts (if any). Once you have done this, go to Tools -> Options -> Charts. Adjust the “Maximum Bars in History” and “Maximum Bars in Charts” tabs by entering 999999999999 into the spaces provided. This is to allow the MetaTrader4 charts to contain as many candlestick bar data as possible, since you will be downloading the historical data on the 1minute chart for at least 10 years.

    Adjust the Maximum Bars in History and Maximum Bars in Charts

    Setting up MT4 for chart data importing

    When this is complete, you should close the MetaTrader4 platform on your PC and move to the next step.

    Step 3
    This is probably the most important step in the entire process, as failure to perform this test properly will make nonsense of the whole process. This is the step where the trader must compile the historical data, which is usually that of the 1 minute chart over a period of at least 10 years.

    Since it is quite certain that no trader reading this would have been trading with the MetaTrader4 platform from E-Global Trade and Finance Group in 2003, the trader would simply have to look for a source of accurate historical data. Many authorities advocate downloading the historical data from History Center. Unfortunately, that source is no longer available online, but traders can access the historical archives of this data by clicking here. This link will take traders to the page where this resource was available. Using this resource, the 1minute chart data for the currency pair to be used in the backtests can be downloaded to the trader’s hard drive.

    Download and unzip the history data to your hard drive. The file would have the .hst suffix. Finally, load the expert advisor into the MT4 Client –> Experts folder on your hard drive.

    Step 4
    Launch MetaTrader 4 again and open the History Center from the Tools menu or by pressing F2 on your keyboard. Double click the chart pair in the left column that you plan to backtest for. A list of time periods will appear below. Start by double clicking on the 1 Minute (M1) column to load the history data for that period. The backtester uses M1 data to generate ticks, so it is important that your M1 data is complete.

    You will need to import the historical data you obtained in Step 3 for this. Therefore, you must click the “Import” button in the History Center pop-up window. Next, click Browse to select the history data file (.hst) from the location to which you downloaded it in Step 3. If the data is successfully imported, you will see a change in the number of bars.

    Import data in MT4

    After import download the data

    Click the Download button to download the full history data for that pair and period. You may receive a Download Warning message – hit OK to continue. The history center will commence downloading. Repeat this process for every other time period and pair that you plan to test with. Your history data should be complete and accurate. If you see “missmatch chart” errors on your journal or if your modeling quality is mess than 90%, it mean that your history data is insufficient.

    Step 5
    The charts to be used for backtesting must be opened offline. Go to File –> Open Offline to open your downloaded M1 chart data offline.

    Open charts in offline mode

    It will take a few minutes for the chart to load, so wait for it. After this has been done, the next step is to convert the M1 history to every timeframe on which you will do the backtests. You do not need to do it for all time frames; just the time frames on which you will run backtests.

    Use the period_converter script in the navigator window. Just go to this window, click on “Scripts”  double click “Period_converter” Input. On the ExtPeriodMultiplier tab, enter the number of minutes contained in the desired time-frame. For M5 enter 5, for M15 enter 15, for M30 enter 30, for H1 enter 60, for H4 enter 240 (i.e. 240 minutes in 4 hours), for D1 enter 1440 (1440 minutes in 1 day).

    Period converter in Metatrader 4

    Wait for the script to finish the conversion and repeat the steps to get 1M data for other currencies, as well as the data conversion for the various time frames.

    Period_converter in process

    When you are done, you can be sure that you have complete data with which to move to the backtesting phase of the project proper.

    Step 6
    Then open the Press Ctrl + R or click View “Strategy Tester”. Adjust your Expert Advisor, parameters, and select the currency to test (for which you have downloaded the 1M data), the time frame chart, the duration of the backtest period, and select the “Every tick” model for the most precise result.

    Backtesting in MT4

    Then click the “Start” button to begin the backtesting.

    Step 7 (optional)
    This is the step of Optimization. With this feature, the trader can use the “Strategy Tester” menu to try out several EA settings to find the most profitable settings/parameters. To carry out the Optimization of the EA, click “Expert Properties” and adjust any variables or settings that you want optimized. Mark the “Optimization” check box, then click “Start” to begin the process. Wait for the result.

    No Comments
    Author:
    Read more

    Sign in to post a comment

     
    You must be logged in to post a comment.
Ankara Escort Ankara Escort Bayan Ankara Rus Escort Ankara Eskort Escort Bayan Escort Ankara Ankara Escort İstanbul Eskort Ankara Eskort