User Tools

Site Tools


metatrader_-_quick_primer

This is an old revision of the document!


MT4 Quick Primer & Orientation

This section describes some of the details you may need to know in order to produce Metatrader exports effectively. If you are familiar with the way in which MT4 works, you can go straight to the section on MT4 Backtesting Quick Start Guide that will get you performing 99% back-tests quickly.

The MT4 Database

MT4 stores historical data in its own custom format which have the extension *.HST and *.FXT. These files are used by MT4 to display information on charts and is also used in the process of back-testing, respectively. The historical data files contain important information for MT4 to evaluate a back-test such as: oAccount details such as the leverage on the account, commissions, etc. oInstrument details such as the lot size, number of digits, tick value and so forth. oPrice information, including bid price & the bid/ask spread is for a particular instrument.

All these details are embedded within the historical database which means when your EA requests information (such as the instrument lot size), it goes to this database to retrieve the details. When MT4 builds its historical database, it sources all this information directly from the broker, but effectively only stores at most the 1-minute bar data of the ticks that are coming in for your broker. When you perform a back-test, information stored in the database history (*.HST files) are used to produce an FXT data file for the purposes of back-testing. FXT files contain the detailed “tick-by-tick” information that is used by the back-tester. An FXT file is generated for each of the time-frames for which MT4 permits back-testing in - 1 minute, 5-minute, 15-minute, 30-minute, hourly, four hourly, daily and weekly. The screen shot below shows the various back-testing periods that are supported by MT4.

The Tickstory system allows you to produce a historical database from pure tick data and replace the existing broker MT4 data with this much higher-quality information.

MT4 Database locations

In order to utilise your own custom exports, it is handy (but not obligatory) to know where MT4's historical database resides. You can locate your HST and FXT files by going to File→Open Data Folder option in Metatrader as shown in the screenshot below.

Selecting this option brings up a Windows Explorer window to the location of where all your Metatrader data files are located. This folder is typically located in the C:\Users\<YourName>\AppData\Roaming\MetaQuotes\Termimal\<ID> folder. If you are using Metatrader's “portable” mode, then the MT4 Data Folder will exist in the same folder as your Metatrader installation (eg. C:\Program Files (x86)\Metatrader).

If you browse to the history/<broker server name> folder, you will see a series of HST files pertaining to each instrument and timeframe. The “server” directory that contains the actual historical data (*.HST files) that were downloaded from a specific server. Often brokers will have two servers - live and demo - and the data could be different in each database. For the purposes of back-testing, it is recommended that you are connected to the 'Demo' server.

If you browse to the tester/history folder, you will locate all the FXT files:

Note how there is an FXT file for every symbol, per time period. For example, EURUSD has a file for 1-minute (EURUSD1_0.fxt) all the way to daily (EURUSD10080_0.fxt - where 10080 minutes = 1 week), weekly & monthly bars. Depending on the time-frame you back-test in, this particular FXT file will be used to evaluate your back-test and contain all the data that is required including pricing data, spreads, valid instrument lot-sizes and so forth.

metatrader_-_quick_primer.1481710264.txt.gz · Last modified: 2020/04/29 06:36 (external edit)