Usage on Windows Vista, Windows 7, Windows 8, W2K8 and later

For the purpose of this article it is assumed that MetaTrader is installed in C:\Program Files\ (%PROGRAMFILES%) and Virtual Store resides in %LOCALAPPDATA%\VirtualStore\Program File\. If your system is 64bit version of windows those locations are C:\Program Files (x86)\ and %LOCALAPPDATA%\VirtualStore\Program Files (x86)\ respectively. Please keep in mind that actual path on your system might be different depending on the folder you installed your applications.

There’s number of ways a MetaTrader 4 can be set up and used on Windows systems later than XP. The problem stems from the fact that MetaTrader 4 is a legacy windows application that writes files under C:\Program Files\, which is not allowed starting Windows Vista and later.

Why it was prohibited? Well… with Windows Vista and later you can have more than one users logged into the system at the same time. Either simultaneously (when terminal license is available, like on Windows 2008) or in active-passive mode when you use “Switch User” functionality and one session is suspended and the other is active. Now imagine both accounts run the same MetaTrader 4 at the same time and each instance tries to write to the same file. It clearly won’t work.
It’s also a security issue. If all programs can write to C:\Program File\ one can alter other program’s settings or even infect it with malicious code like virus, spyware or any malware for that matter.

To let legacy application (like MetaTrader 4) work without being redesigned the concept of Virtual Store (sometimes called data redirection or data virtualization) was introduced that facilitates application compatibility.

Local_Administrator

Account of Administrator type

When application is run under normal user credentials the data redirection to Virtual Store shown on the following diagram is applied.  It can also be a local user account of Administrator type (as shown on image above), which when the UAC is enabled is just an account with access to Administrative privileges, not an account running as administrator all the time. For that reason all files (history, experts edited and compiled in MetaEditor, logs, tester output, profiles etc.)  reside in virtual store location. Note that %LOCALAPPDATA% is something like C:\Users\<USERNAME>\AppData\Local\ where <USERNAME> is the name of the user logged in and as such the path is different for every user.

Virtual Store

MetaTrader 4 and Virtual Store

As having to access some files via C:\Program Files\ and some via %LOCALAPPDATA%\VirtualStore\Program\ Files is highly inconvenient some workarounds appeared that can be divided in following groups:

  1. Live with it. While not technically a workaround but rather a way of live, some people just learned to live with it and access files in both locations.
  2. Disbale UAC. It’s rather bad idea as it exposes whole system to threats like viruses and malware and works only if account type is Administrator (which is by the way the default type of new account created on system after installation). It also allows rogue metalang scripts (EA, library, indicator) to do bad things to your computer. I deliberately do no show here how to disable UAC.
    Run_as_administrator
  3. Install in C:\. Installing directly in C:\ solves the problem to the certain degree as this location is not covered by Virtual Store functionality. Also during installation in C:\ the MetaTrader 4 folder is created with write access for Authenticated Users.
  4. Run as administrator. Setting compatibility flag on terminal.exe (and other MetaTrader applications like MetaLang, MetaEditor) that says “Run this program as an administrator”. Once enabled this option causes an application to run with administrative rights and enables it write to C:\Program Files\ and other restricted areas. It’s also a bad idea (although not as bad as disabling UAC) as it allows rogue metalang scripts (EA, library, indicator) to do bad things to your computer.
  5. Give write access. This technique works by granting write access to MetaTrader 4 folder to every user running Meta Trader. Is seems the best solution from the security point of view as it only enables certain user to access files in MetaTrader folder. The most convenient way is to grant full control rights to MetaTrader 4 folder and all its subfolders and files.
    Following screencast shows how to give full control permissions for a local user Emsi on a local computer EMSI-X64 to a PipsEvolution folder, subfolders and files. To access the dialog in screencast right click on a folder, then open Properties and access Security tab. The procedure works exactly  the same way for the MetaTrader 4 folder.

PipsEvolution works in every of the above scenarios, however certain steps has to be undertaken to configure it properly. Below is the complete list of receipts for every situation.

  1. Live with it. The bad news is that you cannot longer live with it like that. The good news is that it is extremely easy to  fix it. All you have to do is to convert your configuration to Give write access by giving full control rights for a local user to both MetaTrader 4 and PipsEvolution folders by following the instruction in the screencast (to access the dialog presented in the screencast right click on a chosen folder, then open Properties and access Security tab), just mind to chose your user name rather than emsi.
    Virtual_store_move_overOnce you give full control rights, please move over whole content of
    %LOCALAPPDATA%\VirtualStore\Program File\MetaTrader 4\ (or respective path if you installed MT4 in different location) to C:\Program Files\MetaTrader 4\. This step is required to preserve all the configuration changes, downloaded history, scripts and so on you saved so far in virtual store.
  2. Disbale UAC. It’s simple. Everything will work. As long as you use administrative account PipsEvolution will work like a charm. Keep in mind though that you are still vulnerable to all threats. If you want to become secure convert your setup to the Give write access setup as described in the previous point (no need to copy from virtual store though) and re-enable the UAC.
  3. Install in C:\. To make this setup compatible with PipsEvolution the safest choice is to convert your setup to the Give write access setup as described in the first point (no need to copy from virtual store though).
  4. Run as administrator. If your setup is like this you should either set PipsEvolution to run as administrator the same way you did to your terminal.exe or convert your setup to the Give write access setup as described in the first point (no need to copy from virtual store though) and remove the “Run this program as an administrator” flag from compatibility tab.
  5. Give write access. This setup just works. All you have to do is to to make sure to give full control rights for a local user to PipsEvolution folder as shown in the following screencast (to access the dialog presented in the screencast right click on a chosen folder, then open Properties and access Security tab), just mind to choose your user name rather than emsi.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s