Topic: Export Symbols and Settings from MetaTrader

Dear Traders,

Please find attached below a script for exporting symbols and settings from MetaTrader. The script export a DataSource file ready for use in Forex Strategy Builder.

Usage:

1. Run the "FSB Data Source" script in a MetaTrader chart. It will export all Symbols available in the Market Watch window to a file in the "Files" folder under the MT Data Folder.

2. Move the exported file from [MetaTraderDataFolder]\MQL4\File to the System folder of FSB: C:\Program Files\Forex Strategy Builder Pro\User Files\System

3. FSB will load the new data source when you run the program next time.

4. You can change the "Data directory" of the new Data Source. By default, the script sets it to the "Files" folder of MetaTrader. It makes it easier to use it with exporting files from MT with the  Export Data to CSV script.

There are two versions of the script - one for MT4 and one MT5.

Post's attachments

FSB Data Source.mq4 11.43 kb, 498 downloads since 2015-10-11 

FSB Data Source.mq5 11.54 kb, 300 downloads since 2015-10-11 

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

Re: Export Symbols and Settings from MetaTrader

Thanks Popov!

3 (edited by hannahis 2015-10-12 17:15:06)

Re: Export Symbols and Settings from MetaTrader

Excellent work Popov!!!

Finally, downloading data from any MT4 sources can be so easy and done regularly and seamlessly.  That's my dream.

Now with the script attached to any MT4, we can export the data to FSB and best of all, the historical data can be continually updated just with a click of a button smile   Excellent work...thanks, much appreciated.

Re: Export Symbols and Settings from MetaTrader

Hi

If not can the language be German?

It does not come out Button in symbol.

Thank Pit

Re: Export Symbols and Settings from MetaTrader

Hi
Thank you by the update, the following menu.

I understand this correctly with the script you can install all currencies.

Thank Pit

Re: Export Symbols and Settings from MetaTrader

Hi
Thank you by the update, the following menu.

I understand this correctly with the script you can install all currencies.

but the Historen are not adopted?

Thank Pit

Re: Export Symbols and Settings from MetaTrader

This script exports only symbols settings. It doesn't update the data files. You can use the other scripts for that.

Re: Export Symbols and Settings from MetaTrader

Please make this topic sticky cos it's very useful and it took me a while searching through past records to find this again.

9 (edited by GD 2015-11-12 19:35:00)

Re: Export Symbols and Settings from MetaTrader

Dear Mr. Popov

How to change Code to send json file straight to  FSB, in this Directory?

c:\Program Files\Forex Strategy Builder Pro\User Files\System\

How to write it here? I tried but I cannot...


string dataSourceName=TerminalInfoString(TERMINAL_NAME);
   string path=TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files";
   StringReplace(path,"\\","\\\\");
   string dataDirectory=path;

Thanks You

Re: Export Symbols and Settings from MetaTrader

By design MetaTrader can write only in its file folder.

More info: File Functions

For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means cannot be outside the file sandbox.

There are two directories (with subdirectories) in which working files can be located:

- terminal_data_folder\MQL4\Files\ (in the terminal menu select to view "File" - "Open the data directory");
- the common folder for all the terminals installed on a computer - usually located in the directory C:\Documents and Settings\All Users\Application Data\MetaQuotes\Terminal\Common\Files.

Writing on other places is only possible by using external libraries.

11 (edited by GD 2015-11-13 13:45:07)

Re: Export Symbols and Settings from MetaTrader

I found ShellExecute command for mq4
and  ShellExecuteW command for mq5

i.e. ShellExecuteW(0,"Open","C:\\windows\\notepad.exe","","",SW_SHOW);

They can be added inside script
Of course a library is important

#import "shell32.dll" is important

Can I use a dos command inside them to make the copy OR to create a small exe to just make the copy of json file?

Re: Export Symbols and Settings from MetaTrader

Good evening, Popov,

I seem to have a problem with FSB Data Source script..

I think the symbol settings in my broker demo profile match the json file exported from MT, at least, the "swap long" and "swap short" figures do, but in my broker real profile, the settings do not match, do you know why this could be?

Re: Export Symbols and Settings from MetaTrader

FSB Pro saves the config files on closing.

Close the program and check the corresponding Data Source file again. Please note that each Data Source has a different config file.

Check also if you use the correct data source in FSB pro.

14 (edited by Simon 2016-11-05 17:07:09)

Re: Export Symbols and Settings from MetaTrader

Ok, I have closed FSB Pro, and restarted, no change.

I tried again and went to Control Panel > Data Sources > Select correct profile (ETX Real) > Open Data Directory and deleted the DataSource JSON file.

Then I went to my ETX Real Metatrader 4 terminal, made sure all the pairs I want are in the Market Watch window, then dragged the FSB Data Source script onto the chart. It successfully exported the symbol settings data to the "Files" folder in the MT Data Folder.

With the "ETX Real" Data Directory still open, I moved the new DataSource JSON file from MT "Files" into it.

Then I closed FSB Pro, the data directory, the MT4, and the MT "Files" folder.

When relaunch FSB Pro, nothing has changed, for instance, EURUSD "Swap long" is still -2.00, and "Swap short" is also -2.00, when these values for EURUSD in the exported JSON file are:
"SwapLong"        : -10.23,
"SwapShort"       : -1.93,


Perhaps the issue we talked about here is affecting it? Putting SB after the pair?
http://forexsb.com/forum/topic/6347/add … emo-data/

I was also having a problem with FSB Pro "Waiting for data" in my ETX Real profile, and could not start a strategy, but I removed the 'SB' out of all the filenames in the Data Directory for the profile, and now the data seems to be loading.

There are also 19998 ambiguous bars out of 20000 for M5, but I guess that's for another thread!

Re: Export Symbols and Settings from MetaTrader

With the "ETX Real" Data Directory still open, I moved the new DataSource JSON file from MT "Files" into it.
Then I closed FSB Pro, the data directory, the MT4, and the MT "Files" folder.

You have to copy the Data Source json file while FSB Pro is closed. The program saves the config files at closing and it is possible to override your updated file.

16 (edited by Simon 2016-11-06 12:06:49)

Re: Export Symbols and Settings from MetaTrader

I tried again, this time following these steps:

From empty desktop..

-Open MT4 Real terminal
-File
-Open Data Folder
-MQL4
-Files (check it is empty)
-Make sure all symbols I want are in Market Watch
-Drag FSB Data Source script onto chart
-DataSource_ETX Capital MT4 JSON file appears in MT "Files" folder
-Right-click and copy file
-Launch FSB Pro
-File
-User Files Folder
-Data
-Open ETX Real folder
-Delete old DataSource JSON file
-Paste new DataSource JSON file
-Close all applications so desktop is empty
-Relaunch FSB

No change to symbol settings, they still don't match to the values in the JSON file..

I also tried these steps:

From empty desktop..
-Open MT4 Real terminal
-File
-Open Data Folder
-MQL4
-Files (check it is empty)
-Make sure all symbols I want are in Market Watch
-Drag FSB Data Source script onto chart
-DataSource_ETX Capital MT4 JSON file appears in MT "Files" folder
-Right-click and copy file
-Navigate to FSB Pro User files > Data > ETX Real on PC without launching FSB Pro
-Open ETX Real folder
-Delete old DataSource JSON file
-Paste new DataSource JSON file
-Close all applications so desktop is empty
-Relaunch FSB


Same result..

Am I doing something else wrong?

Re: Export Symbols and Settings from MetaTrader

Navigate to FSB Pro User files > Data > ETX Real on PC without launching FSB Pro

You have to put the "DataSource_ETX Capital.json" in "Forex Strategy Builder Pro\User Files\System". Not in the Data folder.

Re: Export Symbols and Settings from MetaTrader

Hello Miroslav,

thanke you for this script, it is very useful.

I got only one problem.  My brokers add commission that is not shown in the symbol properties in MT.

Is there a way to change the script FSB Data Source, to insert a permanent Comission? like you do in the script EA Studio Data export

Thanke you

Re: Export Symbols and Settings from MetaTrader

great thanks a lot