I think this error is occuring because the perl script can't find the dll MS2MT4DLL.DLL, which must be put in the same directory as ms2mt4.pl. I reproduced the error message "Can't call method Call..." by renaming the dll and re-running the script.
If you have done that correctly then you might be using the 64 bit perl installation. I have heard from other people on the forum that you can't use 64 bit installations with 32 bit dlls, so 64 bit perl probably treats my 32bit dll MS2MT4DLL as a non existant dll. Hence the error message. To check your perl installation, open up command prompt and type "perl -v". I'm not quite sure if you can install both a 32 bit and 64 bit version of perl on the same operating system. I've only been using the 32 bit version.
Once you fix the above up, I see another error in the definition of variable $metastockdbpath, it is defined as
$metastockdbpath = "C:\\Users\\Administrator\\Desktop\mt4\\Daily\\Tadawul\\";
you are missing a second backslash just before mt4, so after you fix the first problem you will probably get another error complaining about the directory path.
This directory path you've specified seems interesting because it looks like you are storing your metastock files inside a metatrader directory which is fine. Are you sure these are Metastock files? Does this directory have an emaster file in it?
Most liked posts in thread: Converting Metastock EOD data to MT4 history files for MT4 charting
Page 1 of 2
Okay, once you have downloaded your EOD Metastock data from a data provider, hopefully it should look similar to something like this:
Take note of where your MS files are located as you will need to modify my ms2mt4.pl script and change the path of the variable "$metastockdbpath" to this location. As highlighted below:
There is a need to use the backslash character "\" twice as it is a special character and the path must end with two backslashes.
Once you have done that, if you haven't already done so, move the files I attached in first post to the directory where your Metatrader 4 demo account history files are stored like so:
After that, all you need to do is execute the perl script ms2mt4.pl either by double clicking on it, right clicking or using the command line. What you should see is the following:
and finally, in your MT4 history folder, you should see something similar to the following:
Now you should be able to open up each stock as an offline chart in Metatrader 4 (File/Open Offline).
Just wondering if anyone knows what database format DataHQ or Premium Data will be using in future (say 2-5 years). Anyone got any information on this?
They currently use the Metastock Database format which has been around since I believe 1985. But now that Metastock have dumped their own database after nearly 30 years, do these data providers have any future plans for an alternative?
It's an interesting topic because sooner or later 64 bit platforms will be the norm and these data providers will have to maintain the Metastock Database using 64 bit applications to keep up with the times. Do they have 64 bit applications for this?
A Metastock database contains a master, emaster and xmaster file, which all contain the names of the stocks and an index to corresponding .dat or .mwd files among other things. The .dat and .mwd files store all the quotes for a stock in microsoft binary floating point format. On top of this, I believe only 65535 quotes can be stored, which is still plently for EOD data. For EOD data, I believe a quote record currently contains DATE, OPEN, HIGH, LOW, CLOSE, VOLUME & OPEN INTEREST.
One minor problem with storing data in floating point format is there could be a slight loss of accuracy in some fields. For example the Volume of some highly traded US stocks could lose a precision if it is over I think 10 million or 100 million due to only being able to store 5 or 6 significant digits, but practically speaking, this is not a big issue.
Metatrader history files use double precision, but there is no master file so you have to iterate through each file to get a symbol list. What genius format will these companies use and how will they handle share splits and what not if and when they decide to change database formats?
Thank you so much.
My MS files are in "mt4" folder. I have done all what you have said but the problem is still the same, see this pict.
View attachment 60487
You are right, I am using 64bit but the perl that I am using is working for 64 and 32 bit. I think the problem is the in the DLL file. I do not think it work in win7 64 bit.
I have tried to find a way to come over this but I could not.
any Ideas ??
Mosh, from the image I see when you type "perl -v" you get
Mine has -x86 instead. That's all I got. I don't know enough about calling 32bit dlls from what seems a 32/64 bit installation of perl. I'm using ActiveState Perl v5.16.3 (-x86).
Here are some suggestions
1. Install XP on an old crappy computer then install only 32 bit perl on this computer and see if you can get things to work. Then maybe install this version of perl aswell on your current computer and see if it still works.
2. Ask someone very knowledgable about calling 32 bit dlls functions from your currently installed version of perl.
3. Try another 32 bit scripting language to pass the dbpath into function "int MS2MT4_MAIN_DLL(char *dbpath)" and post into thread .
4. Wait for somebody smarter than me (like Jabatus from Argentina) to post how they got it to work (if at all) on your version of perl
Do you have a 32 bit version of excel? Maybe I could write a vba macro to call the function.
That's all I got right now, I got nothing. What a pain in the ......
I have attached MetaTrader Script file MS2MT4.mq4. You need to put this in the ...\MQL4\Scripts directory and copy the file MS2MT4DLL.dll to the directory ...\MQL4\Libraries. Last time I checked, Metatrader4 was a 32 bit application so that means it can only use 32 bit dlls, so hopefully this should work, although you are not going to get any error messages if it doesn't (unless you put the dll in the wrong directory, which will generate an error message in the experts tab in the bottom terminal pane). When you run the script in Metatrader4, it should dump all the *_xxx.hst files in the root Metatrader directory where the file terminal.exe is located. Then you need to move these files to where your history files are currently stored and you should be able to open them up as an offline chart.
For more information on setting things up, see my Metatrader scan thread in:
Note: You have to edit the variable metastockdbpathStr in script MS2MT4.mq4 to where your metastock files are stored and don't forget to COMPILE .
Hopefully this works
- File size:
- 1.3 KB
Thought I'd add the equivalent python script "ms2mt4.py" (attached below) to perl script "ms2mt4.pl". This script runs with the 32 bit python installation and is to be placed in the same directory location as 32 bit dll "MS2MT4DLL.dll". As with the perl script, this python script equivalently uses the functionality of the 32 bit dll "MS2MT4DLL.dll" to create the MT4 history files. Hopefully this helps people that are having trouble with 32 bit perl, but it does mean you have to install 32 bit python, so you only need to try it if you are having problems with the perl script
Note: You will need to change variable metastockdbpath to where your metastock files are stored as explained in previous posts
Please remove .txt extension from attached file "ms2mt4.py.txt"
- File size:
- 778 bytes
(64bitDLL) Converting Metastock EOD data to MT4 history files for MT4 charting
I have been working on my first ever 64 bit dll for this thread. If you have 64 bit python/perl installed, try my 64 bit attachment MS2MT464_20150509.zip. When you extract it, you will find the 64 bit dll has the same name "MS2MT4DLL.dll" as the 32 bit dll. This makes life easy as you don't have to modify the python/perl scripts. Just copy over the 32 bit dll. Ofcourse you have to have 64 bit python/perl installed on your computer.
Let me know if this works as I'm new to 64 bit programming and it works on my 64 bit computer :iamwithst
- File size:
- 226.7 KB
i have error message
error accessing to master files in dbpath
can any one help please
# mS2mt4.pl by Andrew Code
# This program calls main function in MS2MT4DLL.dll which converts
# EOD Metastock Fn.dat files to MT4 hst files
$metastockdbpath = "C:\\Users\\doctoresam85\\Desktop\\emarket last price\\";
# Main Code
$function = Win32::API->new('MS2MT4DLL', 'int MS2MT4_MAIN_DLL(char *dbpath)');
$return = $function->Call($metastockdbpath);
Page 1 of 2