1 (edited by Popov 2018-07-03 06:59:29)

Topic: MetaTrader to FSB Data Export

Hello traders,

Please find attached a script for exporting csv data files from MT4 and MT5.

Preparation:
- Copy the script in your MetaTrader"Scripts" folder, load the script in the editor and compile it.

How to use it:
- Load a data in all periods of the symbol;
- Run the script on a chart. It will export up to 100000 bars to the MT "Files" folder.
- Copy the exported data in your FSB Pro data folder.

Hints:
- You can create a separate Data Source in FSB Pro for the new MT data.
- Eventually you can set the MT "Files" folder as a data directory in FSB Pro.

https://image-holder.forexsb.com/store/export-data-to-csv-fsb-pro-mt5.png

Post's attachments

Export Data to CSV.mq4 4.57 kb, 443 downloads since 2018-07-03 

Export Data to CSV.mq5 4.58 kb, 347 downloads since 2018-07-03 

You don't have the permssions to download the attachments of this post.

Re: MetaTrader to FSB Data Export

Thanks for this, it will be most helpful.

MT5 data has about the same relaibility as MT4  none. Please keep in mind that there are going to be data problems with MT5 just as with MT4.

Re: MetaTrader to FSB Data Export

The script is updated. It exports all periods with one run now.
Added MT4 version.

4 (edited by GD 2015-06-07 10:01:09)

Re: MetaTrader to FSB Data Export

Dear Dr. Popov

Let us suppose I have one EA developed in FSB using M1 CSV data.

Suppose I use a Timeframe of M5 to calculate the behavior of one indicator used in development of the M1 EA

(I mean, I do use of Longer Timeframe of one indicator in Logic Conditions).

FSB what file uses to receive the information to calculate this indicator M1 CSV file or M5 CSV File?

Thanks in Advance for the answer.

Re: MetaTrader to FSB Data Export

FSB loads and calculates the indicator value sand signals from a separate data file for every chart (symbol/period) required by the indicators. After that the program transfers the signals on the main strategy chart for backtesting and trading. The exported EAs work in the same way.

6 (edited by GD 2015-06-10 03:49:08)

Re: MetaTrader to FSB Data Export

Dear Dr. Popov

Would you please add a time offset to the above scripts in hours???

It can be very helpful to everybody as many brokers have different server times.
             

TimeToString(rates_array[i].time,TIME_MINUTES)

it can be             
             

TimeToString(rates_array[i].time+3600*TimeOffsetInHours,TIME_MINUTES)

Am I correct?

By he way, do you think there is no way to add a TimeOffset to an EA to "understand" bars of different time server like local server ones, against to change every indicator relative to time like BarClosing2 etc?

Re: MetaTrader to FSB Data Export

Yavor

Maybe this page should be a 'sticky'  because many people want to have alternative data sources and may not see this page

Re: MetaTrader to FSB Data Export

How to increase my data source period.

Each time I upload my data source using the script method, the new data over rides the old data,

i.e. from Aug 26 to Dec 2

after upload it becomes Aug 28 to Dec 4.  Two days of new data, replace the two days of old data (26 and 27 Aug).

How to keep all the old data so that my data source can keep building up over the years so that I have longer data period to develop my strategies to make it more "stable"?

Re: MetaTrader to FSB Data Export

You can easily expand the number of exported bars be editing the script. Currently the script exports maximum 100000 bars.

You can change line number 30 to allow the export of more bars.

   int maxBars= MathMin(TerminalInfoInteger(TERMINAL_MAXBARS),100000);

Re: MetaTrader to FSB Data Export

Thanks

Re: MetaTrader to FSB Data Export

You can creat more database on the same period. I have 7 M5 database which follow one to another. In that way I have 3 year M5 database. Now I make a strategy on M5 using 5 generator in 5 diferent database.  I test the results  using "Multi markets" on all 7 databases. In that way you can have a strategy that "work well" for 5 or more year backtesting data. If Popov will make a new tool "multi marketes optimizer"(I talked about it in another post http://forexsb.com/forum/topic/5665/multi-market-optimizer/) we will optimize our strategy using more database and choose the best optin of our strategy.

Re: MetaTrader to FSB Data Export

Thanks for your suggestions

13 (edited by hannahis 2015-12-13 17:39:50)

Re: MetaTrader to FSB Data Export

Popov wrote:

You can easily expand the number of exported bars be editing the script. Currently the script exports maximum 100000 bars.

You can change line number 30 to allow the export of more bars.

   int maxBars= MathMin(TerminalInfoInteger(TERMINAL_MAXBARS),100000);

I've changed the line 30 (script file in MT4) to 1,000,000 and when I do my data download, it still shows 100,000

Did I miss out any other things?  Do I have to change the maximum bar in the MT4 chart under Tools, options, chart?

My data period didn't "grow or extend the period...with every new days added, the same amount of old data removed observed as before.

Re: MetaTrader to FSB Data Export

The script prints the number of bars exported. If it is 100 000, search the problem in the MT settings.

Re: MetaTrader to FSB Data Export

What or where in the MT setting should I search for?

Re: MetaTrader to FSB Data Export

what do you mean: Load a data in all periods of the symbol;

where do i find the MT files folder

you will know that i am computer illiterate by now......sorry

17 (edited by GD 2016-02-18 16:43:26)

Re: MetaTrader to FSB Data Export

Check directory "files" of MT4

Then go to to Data Sources of FSB> Create a source and give as directory there the directory where previous directory with created CSV data is.
The procedure is easy.

Re: MetaTrader to FSB Data Export

open MT4

top left is 'files'
click on files
click on 'open data folder'
click on MQL4

and you will see 'files'

Please, please. spend some time learning about MT4, use the internet and do some research.

Please do some reading about automated trading so that you grasp some understanding of the tasks ahead

Please get to know about FSBPro

This is a serious business and most people try to equip themselves properly so that they are not depending on others.

Re: MetaTrader to FSB Data Export

Blaiserboy wrote:

open MT4

top left is 'files'
click on files
click on 'open data folder'
click on MQL4

and you will see 'files'

Please, please. spend some time learning about MT4, use the internet and do some research.

Please do some reading about automated trading so that you grasp some understanding of the tasks ahead

Please get to know about FSBPro

This is a serious business and most people try to equip themselves properly so that they are not depending on others.

i have gone to data folder and to mql4 and ....files  which when opened is empty

anyway miracles do happen.....i managed to download data......i think even now i am not sure.. screenshot attached

Post's attachments

data.png 218.95 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: MetaTrader to FSB Data Export

Hannahis,

I found your post regarding data source period – that downloading new data overwrites the old data. The script used to download data from MT4 instance on your computer can be adjusted to enable larger data set to be downloaded, by editing line 30 in the script. But the problem which I have encountered (and probably others also) is that my Forex broker will not allow me to scroll back more than a limited amount of bars. For M1 it will be around 2 months of data bars.

And I prefer to have my broker’s data bars to be used in FSB Pro strategy developments. In that way I am more sure that results achieved with FSB and then on demo/live account (with my broker) will be similar.

BTW, I am downloading data bars from Live Account and not from Demo Account, even if I have confirmed that both have exactly same values during the feed process.

My solution to enlarging the data set is to regularly (once a week) download data from MT4 instance and copy it to a separate directory. Then I will use Excel to “glue” additional bars from newly downloaded CSV file to the old downloaded file. It is a lite primitive solution, but it functions perfectly. It takes only few minutes.

Leon

Re: MetaTrader to FSB Data Export

Thanks Leon for the tip

Re: MetaTrader to FSB Data Export

Popov wrote:

You can easily expand the number of exported bars be editing the script. Currently the script exports maximum 100000 bars.

You can change line number 30 to allow the export of more bars.

   int maxBars= MathMin(TerminalInfoInteger(TERMINAL_MAXBARS),100000);

Is there a way I can also change FSB Demo data to increase the maximum bar beyond 100,000?  So that with each new History Download, I can keep expanding the historical period and not such with the current 3mth period?

I tried to make the changes in FSB's user's file/system/FSB Demo data and increase default from 100,000 to 1,000,000 would this allow FSB to keep adding new historical data, expanding the period?  When I tried to download History Data, I see noticed the 100,000 default for 1min chart.  Did I miss anything?  Or this isn't the way to do it?

"StartDate": "1979-01-01T00:00:00",
  "EndDate": "2020-12-31T00:00:00",
  "IsUseStartDate": true,
  "IsUseEndDate": true,
  "MaximumBars": 1000000,
  "MinimumBars": 300,
  "MaximumBarsLimit": 1000000,
  "MaxIntrabarBars": 1000000,
  "MaxIntrabarBarsLimit": 10000000,
  "IsCheckDataAtLoad": true,
  "IsCutOffBadData": true,
  "IsCutOffSatSunData": true,
  "IsFillInDataGaps": true,
  "IsCacheDataFiles": true

Re: MetaTrader to FSB Data Export

No, you cannot. The data files are created online and are trimmed to 100 000 bars.

Re: MetaTrader to FSB Data Export

Download tickstory......... and get all of the data back to 2007

it is the same data as in the program.....

problem solved.

Re: MetaTrader to FSB Data Export

Hello Popov,

I'm trying the Export Data to CSV script, and it is saving data to the MT 'Files' folder like this:

2016.10.21;03:50;127.466;127.468;127.45;127.455;44
2016.10.21;03:51;127.456;127.458;127.448;127.455;31
2016.10.21;03:52;127.455;127.456;127.446;127.447;13

It looks like there should be a "," where there is a ";"

This means it is not saving as a CSV file, no?