Table of contents

Converting to FXT


1. When running CSV2FXT, I get the message “Could not open input file”. What should I do?

That can only be caused by the script trying to open a file that is not there so you either copied the CSV to the wrong folder, named it incorrectly or typed its name incorrectly. Check the following things:

  • You put the CSV file in experts\files.
  • You put the CSV file in the correct MT4 installation folder (if you have more than one).
  • If you left the CsvFile field blank, check that the file is named as your pair and has a csv extension.
  • If you typed something in the CsvFile field, make sure that you typed the full file name including its extension.
  • If your explorer is configured to hide the file extension for known files, your file might be named EURUSD.CSV.CSV and explorer might just show EURUSD.CSV, or your file might be correctly named EURUSD.CSV and your explorer might just show EURUSD. In Windows 7, to work around this issue you can hit ALT in an explorer window, click Tools -> Folder options -> View then uncheck “Hide extensions for known file types”. The procedure is similar for other Windows versions.
  • If you are using Vista and your MT4 installation is in Program Files, I suggest making a copy somewhere else (for instance on your Desktop) and working from that one instead. Vista has something called UAC that can be a royal pain in the ass. You can also disable UAC if you wish, read a few paragraphs below on how to do that.


2. How can I change the fixed spread in an existing FXT file?

Use a hex editor (e.g. WinHex, Neo Hex Editor) and change it at offset 0xFC. Note that it’s going to be displayed in hexadecimal so you’ll probably have to use a calculator.


3. How can I change [some other setting] in an existing FXT file?

Look up the offset in FXTHeader.mqh, it’s displayed next to each setting. Use a hex editor. Note that all values are in little endian format, meaning that if you have a value that exceeds one byte you have to fill in the bytes to its right. For instance, if you want to write 300 in the file you will have to write it as 2C 01.


4. I cannot find the resulting FXT and HST files. Where are they?!

This is typical for Windows 7 / Windows Vista users that run MT4 from their Program Files folder. The issue is caused by the fact that UAC is enabled and these operating systems use folder virtualization. For Windows 7, the resulting files can be found in c:\ProgramData\ typically, while for Windows Vista they can be found in c:\Users\username\AppData\Local\VirtualStore\Program Files\. If they’re not there, just search for *.FXT, they must be somewhere. To get around this problem, either copy your MT4 folder in a location that’s not protected by UAC (e.g. your desktop) or simply disable UAC (type UAC in the start->search box thing and follow the on-screen process).


5. Backtesting an EA with my newly created FXT results in Order Send Error 131. Why?

This might be caused by the lack of a MIN_LOT and LOT_STEP for the symbol in the resulted FXT file. This happens when generating the FXT file with a MT4 client that wasn’t connected to the broker when the script was started. As specified above, your terminal should be connected to your broker when generating an FXT file.


6. What do I do if I get an alert saying Bad CSV Format when I try to convert the CSV I exported from JForex?

This is in all likelihood because you either failed to select a delimiter or selected a dot (.) as the delimiter, so the solution is easy: you go back to JForex, select comma (,) as the delimiter and export the CSV once more. This should be much faster than the first time since the data is cached. If you’re uncertain about the other parameters, take another look at the JForex downloading guide.


7. Is it possible to append tick data to an existing FXT file (and the accompanying HST files)?

No.


8. Is it possible to append tick data to an existing CSV file?

Yes. The CSV2FXT script will disregard duplicate information and even the JForex header line if it is encountered in the middle of the CSV file.

If you are using JForex, you should start your CSV from the time your older CSV ends. You can delete the header row from the new CSV file before concatenating or you can simply skip this step, in which case the CSV2FXT script will skip that line and warn you about it in the experts log. When the export is finished, simply append the new CSV to the older one.

If you are using the PHP scripts, it is ideal to stop your processing at the end of a month. The processing script automatically appends to an existing file so if you resume from the start of the next month your CSV will be perfect. However, you can stop your processing even during the month; for example, if you have a file named EURUSD.csv that ends on 19.03.2012 and then append data starting from 01.03.2012 and ending with 02.04.2012 (e.g. by typing php process_dukascopy_data.php EURUSD 201203 201205 EURUSD.csv), the new data will be appended to your existing CSV and the data between 01.03 and 19.03 will be in your CSV twice. In such a case, the CSV2FXT script will output about 20 errors in your log and spit out an alert about older ticks, but it is smart enough to skip the duplicated data so the resulting FXT should be perfectly fine (although it will take a little bit longer because it has to skip the duplicated period).


9. Why does the CSV2FXT script get stuck as soon as it is started? The progress indicator is not displayed on the chart and the only message displayed in the experts log is “The date column appears to be 0. Sample…”

Most likely this is because you exported the CSV file using JForex but failed to select the comma (,) as the field delimiter as mentioned in the guide. Since for some reason that I fail to grasp the default JForex setting is to use a space as field separator and put several commas at the end of each line, your CSV file is useless and has to be regenerated. The good news is that JForex caches the data so you don’t have to wait for the download once more.

Using the tick data


1. Why are my FXT files being overwritten?

  • If you’re using the free script:
    • You forgot to run the Birt’s patch script. Note that it has to be run every time you restart the MT4 terminal if you wish to backtest using tick data.
    • DLL imports are not enabled (Tools->Options->Expert advisors).
  • If you’re using the Tick Data Suite, you didn’t start the MT4 terminal via tds.exe (and you probably have DLLs disabled so the CSV2FXT script was unable to set the file read-only).


2. Why is my terminal creating an FXT file when I start backtesting?

  • Did you create the FXT file for the currency pair & timeframe that you are trying to use in your backtest?
  • If the answer to the above is yes, did you copy it to the correct location (including the correct MT4 installation folder if you have more than one)?
  • Also see the answer for question #1 above.


3. My backtest runs but I do not get 99% modeling quality. Why?

This is in fact the same question as #2 above.


4. My backtest stops as soon as I click the start button. The backtesting journal tab displays TestGenerator: internal error because the file not opened. What is wrong?

That’s MT4′s way of notifying you that it refuses to overwrite an FXT file that is set read-only. If you’re using the Birt’s Patch script, you probably forgot to run it (keep in mind that you have to run it once after every terminal restart, prior to starting the backtest) or you might be using an outdated version.

If you’re using the Tick Data Suite, you didn’t start the terminal via tds.exe.


5. Why does my terminal crash as soon as I press “start” in the backtest user interface?

  • If you’re not using the latest MT4 build, it’s most likely because the EA was compiled with a build newer than yours and Metaquotes did not think it wise to add ex4 versioning. You can tell this is the problem if attaching the same EA to a chart will also result in a crash. The solution is to use the latest build or get the EA compiled with your build.
  • If you’re using the free script, did you per chance run a backtest prior to running the script?
  • If you’re using the free script, running optimizations will not work.


6. Why do I get a red bar at the end of the backtest even though my modeling quality is 99%?

Because the FXT you are using was created with an older script. It’s nothing to worry about, though – you can safely ignore it.


7. What can I do if my optimization results window is empty even though MT4 appears to run multiple passes correctly?

That means the results you obtained were not profitable. If you wish to see them nonetheless, you can select the Optimization Results tab, right click inside it and deselect “Skip Useless Results”.


8. I am getting empty results (no trades) in all my optimization passes when using the Walk Forward Analyzer. Is there a workaround?

This only happens with some EAs that need the Metatrader 4 terminal to be connected to the broker even when backtesting, for instance Wallstreet Forex Robot or FAP Turbo. To put it simply, since the FXT is already there, the backtest starts too fast. The only solution for this problem is to add an artificial delay, which can be done by using the Configuration program installed with the Tick Data Suite. Just fire up Configuration and increase the Backtest delay factor to something like 3. This will start the backtest with a sensible delay which should be enough for the terminal to connect to the broker. In case it isn’t, feel free to increase it to something like 10. Set it back to 0 once you’re done with that particular EA unless you want to have a permanent delay when backtesting or optimizing with tick data. Note that this option will not have an effect on Metatrader 4 terminals that are already running and you will need to restart these to take advantage of it.


9. Why are all the volumes in my tick data backtest smaller than 1?

It’s because you are using real spread when creating your FXT. When enabling this option, the spread is stored in the volume field. If your strategy makes use of the volume number (which is simply the number of ticks in MT4), you need to use fixed spread or employ other strategies such as counting the number of ticks and storing it in an array.


10. Why does my backtest fail as soon as I attempt to start it with the backtest journal saying “No data for testing.”?

Two possible causes:

  • You enabled Use date and the start and end dates you selected are outside the range covered by your FXT.
  • You are using an FXT larger than 4GB with the Birt’s patch script or an FXT larger than 2GB without removing the limitation, you enabled Use date and the start and end dates you selected are above the 4GB range in the file (respectively above 2GB). Using the Tick Data Suite you can use FXT files of to 208 GB in size.


11. My backtest stops somewhere in the middle, even though the FXT file I created spans a longer time period. How can I fix this?

This is a problem that typically occurs when using the Birt’s patch script and in this scenario it can have two possible causes:

  • You are using a file larger than 4GB; the backtest will stop when it reaches the 4GB limit. There’s also the possibility that you are using a file larger than 2GB and the limitation removal was not enabled.
  • You are using an FXT file with real spread enabled but you failed to enable real spread in the Birt’s patch script.
  • If this happens and none of the above are the causes, you should first attempt to backtest the MACD EA using your FXT and if it stops at the same point, you should investigate the source CSV in that range and check the log of the CSV2FXT script for any potential errors.

  • #1 written by Forexzak March 9, 2012 (2 months ago)

    Can we Back Test Range Bars with Tick Data Suit?

    Or is it possible to run strategy tester on no standard time frame.

    Thanks

    • #2 written by birt March 9, 2012 (2 months ago)

      Not directly, no.

      Edit: well, you can but there are no scripts on eareview.net that create range bars from tick data. This Range Bars Plugin used to have something like that.

  • #3 written by damian March 11, 2012 (2 months ago)

    I put some date in StartDate and EndDate fields and i got 0 kb fxt file ??
    When i leaved this fields empty, everything is “ok”. I got good file but size is more than 2GB

    • #4 written by birt March 11, 2012 (2 months ago)

      Did you respect the YYYY.MM.DD format? Were the dates inside the range available in your CSV file?

  • #5 written by damian March 12, 2012 (2 months ago)

    Yes, i did. :(
    I have csv file EURUSD from 2007.03.01 to 2012.02.29.
    When I’m genereting a first fxt file (2007.03.01 to 2009.12.31), everything goes ok. Problem appear when i want get fxt file from 2010.01.01 to 2012.02.29).
    When i put any date in StartDate fields always get o kb fxt file

    • #6 written by birt March 12, 2012 (2 months ago)

      You do know that you have to wait quite a while for processing to start if you select 2010 as the start date, right? The script has to go through the CSV until it reaches 2010, which is 3 years from 2007. That would take some 10+ minutes, I guess. Did the script say “processing finished”? What did you get in the experts log?

      • #7 written by damian March 12, 2012 (2 months ago)

        Oh my God it was so simple :D Thanks a lot birt :)

  • #8 written by sepp March 15, 2012 (2 months ago)

    Hi, I have downloaded AUDUSD with dukascopy from jan 2010 on.
    if i do the csvfxt script, i get allerts ” Possible error: large gap after 2011.11.20 22:59:57 (8.0 days).” serveral times. in MT4 the message “CSV2FXT AUDUSD,M1: Broken record in the CSV file after 2011.12.20 13:29:47″ is comming. Do You know whats the problem could be?
    Thx, Sepp

    • #9 written by birt March 15, 2012 (2 months ago)

      The problem is in your data. There’s a large gap where it says there is and a broken record after the date specified.

      There are no such problems in my AUDUSD data so I’m guessing something went wrong with your download. You could attempt downloading it again or you could use a different downloading method.

    • #10 written by birt March 15, 2012 (2 months ago)

      By “my AUDUSD data” I mean the AUDUSD data that I downloaded from Dukascopy and is sitting on my harddisk.

  • #11 written by sepp March 15, 2012 (2 months ago)

    ok thx, i will download again and test.

  • #12 written by GeeGee March 15, 2012 (2 months ago)

    Great work Birt, I really appreciate it … I tried your scripts, everything works fine – when I run any backtest, I get 99% quality – Great! I run your patch automatically at start of MT4. But I cannot optimize any EA – everytime I start optimization, Metatrader (build 409, win7 64) crash (end to win) – before first result – I tried 3 different instances, connected/disconnected to broker – with same result. Thank you for answer and all of your work. GG

    • #13 written by birt March 15, 2012 (2 months ago)

      That’s a known issue – the Birt’s patch script does not support optimizations. You need the Tick Data Suite for that.

  • #14 written by Eric March 23, 2012 (1 month ago)

    Hey Birt,

    Have a question for you. I’ve done all about what you guid us to do. But when I was trying to use some commercial EA, such as “Forex Growth bot” and “Wallstreet forex rebot” to do BT, the MT4 journal only showed those EAs’ inputs information and the BT did not work. However, using MACD for BT can work. Do you know what’s going on with this issue??

  • #15 written by birt March 23, 2012 (1 month ago)

    Did you input your authentication information in the EA parameters? I suggest attempting to use visual mode, your chart may have more information.

  • #16 written by Joe March 25, 2012 (1 month ago)

    Hi Birt,

    I’m trialling TDS. I ran a succeddful backtest on GBPJPY on H4 for the period 2012.02.01 to 2012.02.29. I then went and downloaded from JForex (as before) GBPJPY data for all of 2011. I removed the old CSV & FXT files from experts\files & tester\history respectively & placed the new CSV in experts\files. I then tried to convert the CSV to FXT on a H4 GBPJPY chart )as before) & I keep getting the following 2 errors:
    (1) “Unable to open experts\files\GBPJPY240_0.fxt. Proceeding with the others”
    (2) Unable to open any of the FXT files. Aborting.
    I’ve read the guide, FAQ, trobleshooting, etc but keep getting the same error.
    Any ideas??
    Thanks,
    Joe

  • #17 written by Joe March 26, 2012 (1 month ago)

    HI Birt,
    Please disregard the above as I worked it out. I was trying to test over a date range for which there was no data. My bad.

    • #18 written by birt March 26, 2012 (1 month ago)

      Actually, the unable to open message occurs when you did not move the FXT from experts/files to tester/history. Since the FXT is set read-only to prevent its deletion by MT4, the CSV2FXT script is unable to overwrite it.

  • #19 written by Joe March 27, 2012 (1 month ago)

    Thanks very much Birt for explaining – appreciate it. Joe.

  • #20 written by Zubair March 27, 2012 (1 month ago)

    Hi Birt
    I am using your TickData Suite.

    I have a request and don’t know if you can do something with that.

    I am using 15-Pips Range Bars for backtesting my strategy, I was wondering to ask you how can I test them offline.

    Currently, I use M1 chart and my RangeBar Script and and TimeFrame I use is M5, so my 15-pips range bars are created on a 5M time frame and then I use M5 time frame in an offline server and are able to test.

    However, I am not able to get good results as the bar jumps sometimes.

    Please let me know if this is possible, I was wondering if you can write a special CSV2TXT script that create the FXT/HST based on Rangebar and the file is created is of standard time frame name. Then may be we can test the rangebars in offline server as well.

    Thanks

    • #21 written by birt March 27, 2012 (1 month ago)

      The CSV2FXT script will not allow you to do that unless you modify it yourself.

      The commercial range bars plugin available at the-forex-strategy.com used to include an adaptation of one of my older CSV parsing scripts but I don’t see it advertised anymore, presumably because the scripts changed a lot since the modification and the range bars plugin author lacks the time to keep up with the latest version.

  • #22 written by Tyler March 31, 2012 (1 month ago)

    Hi Birt,

    I was using a trial version of TDS 1-2 weeks ago, with everything working perfectly. I uninstalled my trial version and purchased TDS today, installing the latest version of TDS and CSV2FXT. I also upgraded my platform (ILQ MT4 client) to version 418. Now, when I run the CSV2FXT script (version 0.33), I get no progress bar, only a gray “Label” text display on my chart, and after running for about 10 minutes, it completes after saying “1 ticks added”. In the “experts\files” folder, all FXT and HST files that were created are of size 1 KB. I have inspected the CSV files and they look to be perfect (created by your PHP script). Any idea what might be causing this? Again, everything worked perfectly before I updated to the latest versions of TDS, CSV2FXT, and my MT4 client. I am a long time user of your tools and have never had any functional issues before this strange problem. Thanks.

    The only thing I can think of is that it is the weekend (non-market hours), but my client says it is connected to the broker.

    Any thoughts?

    Tyler

    • #23 written by Xin April 1, 2012 (1 month ago)

      I got the same problem. My MT4 version is 418. The issues are exactly the same as described by Tyler. My OS is winxp SP3. I will try an earlier version of MT4 to see if it works.

      • #24 written by Tyler April 1, 2012 (1 month ago)

        Thanks for confirming, Xin. Any luck with an older version? Perhaps it’s a bug with CSV2FXT and build 418?

        • #25 written by Xin April 2, 2012 (1 month ago)

          I installed a build 225. Everything works fine. :)

        • #26 written by birt April 2, 2012 (1 month ago)

          The bug is in MT4 build 418, see http://forum.mql4.com/47037 for more information. It affects a whole ton of EAs and also the CSV2FXT script.

          Build 419 is out since yesterday and fixes the bug (it introduces another bug, though) but it’s not yet available for upgrade for all brokers. If your broker doesn’t offer 419 yet, you can either wait until they do (might take 1-2 days, worst case I’ve seen was 1 week) or you can downgrade to 416.

          As a rule of the thumb, I recommend not updating MT4 unless you actually need to. The older terminal versions were much more reliable than the new ones.

          • #27 written by Fibo19 April 2, 2012 (1 month ago)

            How can i downgrade to 4.16 please ?

            • #28 written by birt April 2, 2012 (1 month ago)

              Google “downgrade mt4 416″.

  • #29 written by Fibo19 April 2, 2012 (1 month ago)

    CSV2FXT v0.33
    MT4 v4 Build 3.99

    Unable to open any of the FXT files. Aborting.
    You can help please?

    • #30 written by birt April 2, 2012 (1 month ago)

      The FXT file(s) that you are trying to create is already there in your experts\files folder and its readonly attribute is set. Move it somewhere else or delete it before running the script again.

      • #31 written by Fibo19 April 2, 2012 (1 month ago)

        No, in the expert/files folder is only the csv-file i downloaded from Dukaskopy

        • #32 written by birt April 2, 2012 (1 month ago)

          In that case it means the script does not have the required permissions to write in the experts\files folder. I would suggest checking your UAC settings (see above) and that you have some free space on the drive.

  • #33 written by Fibo19 April 2, 2012 (1 month ago)

    With MT4 Build 4.18 is the same:

    Unable to open any of the FXT files. Aborting.
    You can help please?

    • #34 written by birt April 2, 2012 (1 month ago)

      Do not use build 418. It has a severe bug that completely breaks the functionality in CSV2FXT (see my post ~5 comments above yours).

  • #35 written by L. April 13, 2012 (1 month ago)

    Hi guys!

    Can somebody help me? I downloaded the tick data via Jforex terminal, and converted it seemingly successfully (the MT4 terminal displayed the conversation up to 100% – although there was a gap after 12.06.2009). The problem is that I don’t find the fxt and hst files anywhere. I’ve Win 7. If any of you guys have faced the same problem please let me know where you have found these files. They are not in the expert/files folder, not at the ProgramData folder, and even there is no result when I try to search it by the name *,FXT.

    Thanks in advance, and thanks Birt for the great tools and useful information on your site.

    • #36 written by birt April 13, 2012 (1 month ago)

      Edit: rushed the reply and thought you didn’t run CSV2FXT but reading your comment a second time makes it obvious that you did.

      If you have UAC enabled and MT4 in Program Files, try searching in c:\Users\[username]\AppData\Local\VirtualStore\Program Files\[your MT4 folder name].

  • #37 written by L. April 13, 2012 (1 month ago)

    Thank you. I’m gonna do that. I hope that I’ll find it. Btw I’ve tried to convert the csv file again and it displayed “Unable to open any of the FXT files. Aborting”. Is this because it already exists?

  • #38 written by L. April 13, 2012 (1 month ago)

    Heureka!!! I’ve found them! they were there. Thank you very much! :D

  • #39 written by xylene2301 April 25, 2012 (3 weeks ago)

    Hello Birt,
    I’m trial testing your Tickdata Suite. The installation went smoothly and MT4 comes up as expected when TDS.exe is opened.
    I’ve downloaded EURUSD tickdata from Dukascopy and converted to 5 minute .hst and .fxt via your CSV2FXT script. The resulting files are EURUSD5.hst at 1003 KB and EURUSD5_0.fxt at 326,526 KB. The .fxt I put in my MetaTrader\tester\history\ folder. The .hst is in MetaTrader\history\HFMarkets-Live Server folder.
    I opened MT4 with TDS.exe and run the strategy tester on EURUSD 5M using dates 2011/01/03 to 2011/01/04 in visual mode.
    I hit the start and the progress bar moves very fast to completion regardless that the speed is set to minimum. The chart is just a blank grid with no bars. My indicator window 1 is there but no indicator. The text objects are not displayed on window 0. There were no trades. The report says there were 23326 bar in the test. 6430018 ticks modelled at a quality of 99%.
    Any idea what’s wrong?

    Xylene

    • #40 written by birt April 25, 2012 (3 weeks ago)

      Sounds like the start and end dates you selected are not in FXT file. What happens if you disable the “use date” checkbox?

      • #41 written by xylene2301 April 26, 2012 (2 weeks ago)

        Thank you Birt.
        You were right; It was the dates. :)

  • #42 written by ben April 26, 2012 (3 weeks ago)

    birt,
    what have you been doing about backtest data since dukascopy stopped working as of feb 1 2012?

    • #43 written by birt April 26, 2012 (3 weeks ago)

      It didn’t stop working but if you’re using the Dukascopier, you can’t get any newer data.

      However, if you’re using JForex, the Dukascopy website or the latest version of my PHP scripts, everything works fine. Check out the Download free tick data page for more information.

  • #44 written by Laszlo May 12, 2012 (4 days ago)

    Hi, Birt!

    2 questions at once :)
    1./ Using CSV2FXT on the same EURUSD.csv once I got a 3,6G file while repeating it next day the file size was 2,7G only. Do you guess any reason?

    2./ Creating FXT I put a fix spread 2.0, but in backtest terminal symbol properties shows 6. I guess it shows the actual real one on chart, yes? If yes, how can I check what is in FXT, whithout using a hex editor which is a bit complicated for me.
    regards: Laszlo

    • #45 written by birt May 12, 2012 (4 days ago)

      1. Perhaps you entered a different start or end date or you exited the MT4 before the conversion was finished. Using the same CSV file and the same parameters in CSV2FXT will result in identical FXT files.

      2. Disregard the symbol properties. The easiest way to do it is to create a new EA, name it spreadtest or something and write in its start function:

      Comment("Spread: " + DoubleToStr((Ask - Bid) / Point, 1) + " pips");

      and backtest it in visual mode.

  • #46 written by Sean May 12, 2012 (4 days ago)

    I am running FXDD MT4 Live version 4.00 Build 409 with your Birt EA patch. Everything went smoothly except now I am getting the error “Testgenerator: internal error because file cannot be opened.” when I try to run a test. If I run your newest Birt EA patch, I get an error saying it only works with versions up to 409 (which it is.) I found an older copy of your patch and it seems to work, but I still get the same “Testgenerator” error even though your patch is running with a smiley face on my chart and there is no notice about it being removed in the experts log. Says it loaded successfully and shows the inputs. The newest patch removes itself saying “Works only up to MT4 build 409″. Any suggestions? Or does it not really work with versions up to 409, maybe only 408???

  • #47 written by Sean May 12, 2012 (4 days ago)

    Disregard. As we say in the tech world PEBKAC… It was my error. I had copied your script in the experts folder, not the experts\scripts folder. I moved it to the correct folder and it now works fine! Sorry for the false alarm!!!

  • You may use these HTML tags: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <strike> <strong>

     

  • Comment Feed for this Post
Go to Top