- Install an additional MT4 instance
Use only a dedicated terminal for this script and testing (or duplicate your current one). Do not run the script and tests directly on the MT4 trading instance, the script may harm your trading.
- Install an application for downloading tick quotes and building a generic tick file.
See Preparing the input file section in this page.
FXT Builder Inputs
Before dropping the script to the chart:
- Ensure you have your input tick file available.
- Check, if you are connected to your broker.
- Check, if the symbol on the chart is the one your input file is for. Basic data of the symbol gets fetched from the chart you drop the script on.
- Check, if your chart timeframe is what you wanted to set in the tester. You may also overwrite the timeframe later in inputs.
You may prepare multiple FXT files, one per each tested timeframe (M1 through Daily)
After you dropped the script to the chart, you have to fill inputs similar to this (a particular builder inputs differ in parameters specific for their construction).
Note: The parameter units (points) and many additional data are determined from the chart, which the script is running on. It saves the user many additional symbol-specific parameters for the Strategy Tester, but the script must run on a chart with the proper symbol. The script warns the user if the file name does not contain the symbol of the current chart.
The inputs start with one or multiple chart parameters, like the bar range, or the brick size. They depend on the chart type and have similar or identical meaning like in their live chart counterparts.
Brick size, Step size, Trend step, Counter step, Relocate Open – Renko / PonitO specific definition parameters.
Bar range, 1-tick gap – Range Bar specific definition parameter.
Then, the Strategy Tester specific inputs follow.
Spread – distance between Ask and Bid for static spread. The parameter unit (point) is determined from the current chart rather than the input file.
Set this parameter properly, even if you think it does nothing. It affects the bid price offset – adding 2-pip spread moves the bid by 1 pip down and the Renko candles may draw differently. For the static spread, the FXT builder calculates mean of Bid and Ask, and adds the spread in a symmetrical way around that mean.
In case of selecting the TDS variable spread, this number adds padding to the (Dukascopy) spread. The padding is required for most brokers, as Dukascopy spread is rather tiny and does not contain commission fe
FXT starting time, FXT final time – applies testing chart limits in case of using only a part of a huge input file
Tester Chart Timeframe – by default, the script takes over the symbol and timeframe of the current chart for the tester file. This input can change the timeframe from the default. You may generate multiple FXT/HST files for a single instrument, one for each timeframe, M1 through to D1.
Leading candles count – this parameter must ensure, that all calculations used in the EA have enough initial data. E.g. when the EA uses a 500-candle moving average, then the starting candle count must not drop below 501.
In the test report, the leading count is visualized as a data blok in front of the tick data:
Optional full path to the CSV file – the input CSV file path and name. The path may be enclosed in double quotes. When a valid file path to the CSV file is entered, then the manual file selector will get skipped.
Static Spread Testing
Do not skip this information, it describes a somewhat tricky part.
The static spread is the default behaviour of the Strategy Tester. You do not need to deploy any additional tool for performing tests with the static spread.
But… Unfortunately, the MT4 keeps changing the tester behaviour. So different builds require different treatment for the initial spread settings before the test.
- Builds 970+ (the current public builds) – in addition to the spread entry in the FXT BUILDER, you have to enter the (same, or similar) spread into the Spread field of the Strategy Tester Settings pane. For the most precise test output, the values should be close or even same, though the value in the tester is much more important.
- Builds 940-950 need tricky treatment, so avoid them if you can. When you must use them:
- Enter the spread into the Spread field of the Strategy Tester Settings pane (same as previous builds). Do not start the test yet, the entered value would still be ignored.
- Select a testing method other than the “Every tick”.
- Click Start button, but stop and discard the test immediately.
- Select the method back to “Every tick”.
Now this spread is valid for subsequent testing of the FXT Builder files unless you repeat this procedure or restart the terminal.
Variable Spread Testing With TDS Launcher
The variable spread is an option available in TDS. The TDS launcher is a commercial (and well documented) application, which start and patches the MT4 Terminal executable when launched. What is its purpose in short?
Those who started the terminal by means of the TDS launcher would
- take advantage of the variable spread contained in the input data file
- apply a random slippage when testing
- see the final report with 99% number in the “modelling quality” field (“n/a” otherwise)
The FXT Builder has option to add the variable spread data for the TDS tool (if selected in the inputs).
Please read the TDS documentation for detailed information. I am not connected to this product, so I cannot take any responsibility for the TDS compatibility and behaviour.
And finally, a short experience when using TDS launcher. Some EAs may give different results when started by the TDS launcher in comparison to the pure MT4 test (with the same static spread). No idea what the reason is, but I would recommend to run a short-period test in both modes on an identical data file (i.e. with and without the TDS launcher) to ensure the results are identical.
Strategy Quant Import
For the Strategy Quant users the import of the generated chart can be achieved. You have 2 options to select from.
Saving the chart, Option 1
After the FXT Builder finishes the build and still displays the final GUI screen, hit the Preview button.
The offline chart opens.
Rename the file to what is convenient for you (e.g. EURUSD_100_renko.csv) and save it to your SQ import folder.
Saving the chart, Option 2
In case your FXT Builder has already gone, you may restart the MT4 terminal to the offline testing mode, using the RestartToTest script.
In the offline test mode select the symbol and timeframe of the chart, which the FXT Builder generated (usually the one it was running on).
With that chart on top, select the menu ‘File->Save As’, or simply hit the ‘ctrl+S’ key.
Rename the file to what is convenient for you (e.g. EURUSD_100_renko.csv) and save it to your Strategy Quant import folder.
After you saved the chart into the CSV file, you may proceed to Importing the data file to StrategyQuant.
Preparing the Input File
The FXT Builder needs a single CSV-formatted file to read the tick data from. There are several tick data suppliers. (If you find another tick archive, send a short file fragment to include the format to the FXT Builder).
For all the above providers, decompress the files after download and concatenate them into a single file. You may use the OvoMerge!TickFile script for a safe concatenation. The tick file may be any length (i.e. larger than 4GB).
Tick data in hourly files is compressed by uncommon method. Currently there are two vendors with very handy tools, supporting the download, decompression and concatenation of the (Dukascopy) historical tick data; the Tickstory and SQ Downloader. You may use either of them.
When using the Tickstory, select export to a tick file in a generic format (no MT4 files):
Final Builder Screen
Once the generator finishes the its run, there are 3 new files created.
- FXT file in the Strategy Tester folder (read-only , shared by all the trading servers)
- corresponding HST file in the “test” virtual server folder
- identical offline HST file in the current server folder for preview
The graphical interface displays the final look. Besides information about the finished job, there are a few buttons to select the next action.
- The closing icon in the upper right corner – closes the GUI and finishes the script. It is typical action, if you intend to proceed only with visual testing, or if you intend to generate additional FXT files, or when postponing the testing.
- The Go Offline button is intended for preparing the virtual testing environment. Copies necessary files, logs out of the current trading account and restarts the MT4 Terminal to the testing account. In this mode the terminal is able to perform non-visual tests and open the chart from the Tester pane afterwards. If you decide to go to the “test” later, you may use the additional RestartToTest script (available for download).
- The Show FXT button opens Windows explorer with the FXT file(s), when you intend to save the file for later use, or delete large FXT files to save space.
- The Preview button opens an offline chart with a copy of the final HST file.
Explanation of FXT And HST Charts in the Fxt Builer
The Fxt Builder creates two files.
- a file with the FXT extension. It contains ticks, which the Strategy tester will use for its run. In addition to the ticks, it contains an evolving image of the tested chart. The image is used when testing with a “Visual” option on.
This file is set as read-only to prevent the Strategy Tester from rewriting it. If you intend to use the natural Strategy tester algorithm again, scratch all the FXT files in the explorer.
- a file with HST extension. The HST file contains a final image of the chart. This chart image is used when the “Visual” option is off, and the “Open Chart” button in the Strategy Tester is clicked. One more HST chart (identical) is created for the “preview” button of the FXT Builder, but it has no relation to the Strategy Tester.
The artificial offline charts differ from time charts in some aspects:
- The Open price may not have any relation to the first tick.
So the very first tick of the candle is usually not at the Open price in offline charts. The first tick may print a candle where open and Close prices are different. The Close price is the tick price.
- The Close price may not have any relation to the last candle tick.
When a new tick meets the chart role condition, it leaves the current candle, and becomes the first tick of the next candle. Before it happens, the Close price of the current candle is fixed to meet the chart rules.
- There may be no ticks in the candles.
While the regular chart simply skips such “zero tick” candles, the offline artificial chart cannot afford it, as it would spoil its rules. So you may spot the “phantom” candles to appear in the Strategy Tester, and the single tick may print out a series of such phantom candles, usually when filling a price gap.
Note: For some reason the FXT file cannot display candles with zero volume. So they still display 1-tick volume in the the Visual chart, while they have zero-tick volume set in the HST file (the Open chart button). In any case, the phantom candles do not produce a tick in the Strategy tester.