Running MetaTrader 4 Client Terminal on Linux-Desktop

Bazilevich Vadim | 28 June, 2007


Introduction


Like the majority of programs, written exceptionally for a family of Windows operation systems, the MetaTrader 4 Client Terminal was long unavailable for use by Linux operation system admirers. Launching this program using vmware emulator doesn't count. This emulator uses too many resources. Besides it is not an opensource, which the author of the article considers a disadvantage. Moreover, the developers of this generally good program make the registration, necessary for receiving and using their product, more difficult with each new version. There is also Lin4Win. It is also paid, so the opensource fans do not face a wide choice - only wine. GPL license, under which the program is distributed, allows involving a great number of programmers from all over the world in the development of this non-emulator. That is why the new versions of this program appear on the average twice a month, sometimes even more often. With each new version the number of programs, working under Windows, that now can be launched using this emulator increases. Now let's get directly to running MetaTrader 4 Client Terminal.


Preparations for the Installation of MetaTrader 4


To start the MetaTrader 4 the following software was used:

  1. FontForge (fontforge_full-20061019.tar.bz2) - fonts editor, used for creating own fonts of the following types: postscript, truetype, opentype, cid-keyed, multi-master, cff, svg and bitmap (bdf, FON, NFNT) or editing the existing scripts. Actually it is not necessary to start with its installation, but anyway later you will need this program. Better take the last version. During the time, when the article was written, the version in the link was actual;
  2. Non-emulator wine (http://www.winehq.com/), the software developer insists, that wine is not a true emulator. He (the software developer) is in a better position to judge. For installation the author used the version wine-0. 9.21, downloaded at http://sourceforge.net/project/showfiles.php?group_id=6241&package_id=77449. When writing the article the author enthusiastically acknowledged about a new version wine - 0.9.23. What version to use does not make great difference. But it shouldn't be earlier than 0.9.21. The author didn't experiment with older versions because of lack of time. Later this point will become clear;
  3. MetaTrader 4 Client Terminal;
  4. For launching MetaTrader 4 Client Terminal MFC42.DLL library was used. This library belonged to ОS WindowsXP. Its length is 995383 bites.

The following two moments are very important for the users that will install MetaTrader on Linux-desktop:

  1. The author of the article thinks that errors of MetaTrader 4 operation under wine may occur in case of a wrong version of MFC42.DLL, that is why try to find a library of the indicated length. Perhaps users more experienced in Windows know how to discover the version of a library. After more than five years' working in Linux only, the author became disaccustomed even to the look of this Bill Gates' software;
  2. MFC42.DLL library, whose location in wine system will be specified later, must have exactly this name (all capitals). For *nix family operation systems files of the same name, differing only in capitals in the name, are different files. That is why if the library that you have honestly borrowed contains small letters in its name or extension, rename it.

X-server enabled Linux and *.ttf fonts should be installed on your computer. There are two ways to get the latter.

The first way is to use Windows fonts. They must be stored in the folder Windows\Media\Fonts or on Windows-machine.

The second way is the legal one. Using the following links: http://www.microsoft.com/truetype/fontpack/win.htm, http://www.sisyphus.ru/srpm/fonts-ttf-xorg you may find and install Windows-like fonts in your Linux system.

Depending on the distributive you use, the location of fonts may differ. In the ideal case they can be already installed in your system. If not, specify the location of the file xorg.conf or xconfig.conf. They might be somewhere at /etc/X11. Viewing the content of the X-server installation package from your distributive will help you find the exact location. After you find this file, define a path to the directory, where the honestly borrowed files of ttf-fonts will be located. If this file already contains paths to other fonts, you need just so add your directory, where ttf-fonts will be located.

Example:


Paths: /usr/X11R6/lib/X11/fonts/TTF_win, /usr/X11R6/lib/X11/fonts/TTF_corel_u, /usr/X11R6/lib/X11/fonts/TTF_corel_w were added.


Installation of MetaTrader 4


If all the preparation steps were taken, you may start the installation. Start it in that sequence, in which the programs were enumerated in the list of the necessary software. So, begin with FontForge. Installation operations or at least "make install" command should be performed with root superuser rights. Unpack "fontforge_full-20061019. tar.bz2" package with source texts into any catalogue (you may create a temporary one) and start the command of the automatic configuration ./configure in the folder with the unpacked folder. After the end of the autoconfiguration start the compilation command - make. When it is ended - make install. After the last command is performed, the package will be installed.

To facilitate the operation of the programs that update packages and have different names in different distribution packages, let's create a package. The author thinks that the most successful program for the creation of installation packages for the majority of common Linux distributives is the program 'checkinstall' (http://asic-linux.com.mx/~izto/checkinstall), with the current version 1.6.0. To create a package in the directory, where compilation took place, after unpacking and installation it is necessary to perform checkinstall command and the command will help you in the interactive mode to create an installation package for your distributive.

After the installation of fontforge_full-20061019.tar.bz2 package, you may start wine installation. The unpacking of this package does not differ from the previous one.

Users should note the following:

  1. In order not to have to restart the wine package compilation, it is necessary to provide enough space in the directory, where the wine compilation will take place, about 1.5 Gb;
  2. The wine compilation a little bit differs from the common one. The directory with the unpacked program has a sub-directory ./tools. Exactly there the wineinstall program should be started;
  3. The launched by wineinstall autoconfiguration will not start, if this command was started by a user in the name of a superuser - root. That is why start the command in the name of a current user;
  4. The configuration speed, as well as later compilation and the wine program installation, fully depends on the operation speed of your computer;
  5. When the autoconfiguration is completed, standard commands make and makeinstall are used;
  6. The installation can be completed by the same program of packages creation - checkinstall;
  7. The commands: make install and checkinstall must be performed by a superuser - root. Though in this particular case you may face lack of space on the dedicated partition because of the big size of the created files (during package creation). That is why in the case of wine it is not necessary to create a package. The program will work without it.

Running MetaTrader 4


The first start of MetaTrader 4 is performed this way: 'wine . /mt4setup.exe'. After that a standard window of MetaTrader 4 installation opens. The author thinks it not necessary to show the screenshots of MetaTrader installation in this article, because the qualification of users that use Linux everyday, is enough for installing the program without such hints. New versions of wine usually do not require additional setup. To get the sound, users, preferring the sound subsystem ALSA, would probably have to view the settings file or start winecfg and make necessary setup in the interactive way.

Example:




After the start of the above command 'wine ./mt4setup.exe' a new catalogue '.wine' will be automatically created in the home directory of the current user. That is why, ito avoid changing rights on the folder '.wine' and moving it into a catalogue of the user that will work with MetaTrader, the author strongly recommends to launch MetaTrader installation command from the name of a user, who will work with this program. The author of the article makes an apology to Linux gurus for such a detailed description of the commonplace truth.

The setup of MetaTrader connection to a terminal is identical to that of Windows.

And finally the finishing strokes.

To start MetaTrader 4 from the menu of ANY window manager, one can use the following sequence of commands:

'cd /home/user/.wine/drive_c/'Program Files'/MTrader4/; wine ./terminal.exe', where /home/user is the home directory of the current user.

Here is the result of the work done:



Best regards Basilevich Vadim aka bvv2001.

P.S. In future the author plans to write an article describing programs, intended for operation on Linux platform, that assist the work of traders. During the article proofs, the author had the chance to check MetaTrader operation using the new wine version 0.9.24, downloaded from the abovementioned site. The installation of the new version is identical to that, described in the article. At a glance the time of MetaTrader start with the new wine version decreased by 15-20%.