Let money do the work

MetaTrader 4 on Mac OS X with Wineskin

It was a while back that I attempted to run MetaTrader on Mac. A couple of years past and some new options available warrant a new post. This time I’m using a porting tool called Wineskin. It is based on Wine, same as Codeweavers Crossover we tried last time. Let’s get straight to pros and cons.

Pros and Cons.

Pros:

Both Wine and Wineskin are open-source projects and running MetaTrader with them won’t cost you a dime. You don’t even need a Windows licence. It’s all free.

It creates a wrapper around our Windows application, which looks like a native OSX application bundle and switching between windows (say, trading terminal and MetaEditor) is no different than any other OSX application. That also means you can transfer or share your bundle if you want to.

Since it is based on Wine, which use isn’t limited to OSX, we can leverage all the experience and know-how of Linux crowd. In fact, I referred to quite a few Linux-based how-to’s while exploring the subject.

There’s quite a community around these projects and they are constantly improving.

Cons:

Apparently you may run into some stability issues here and there, but that pretty much depends on the quality of the wrapper you create using these tools.

Install Wineskin Winery and create a wrapper

As mentioned above you can share the final application bundle, although sometimes it may be too hefty. My MetaTrader bundle got to almost 300Mb, for instance, but it can easily go into gigabytes if you download some history data for EA tester. Therefore, we are going to have a look at creating our own bundle here.

First thing you need to install Wineskin. Head down to the Download page on Wineskin website and get Wineskin Winery. Just run it and generate a new wrapper. It should be pretty straightforward even without reading a Wineskin’s manual. When prompted give it a name, ‘MetaTrader4’ will do.

Set up your wrapper

Now that you’ve got your wrapper you’re going to do some setup within it as if you would be setting up a Windows virtual machine instance. Wineskin Winery does put wrappers into “unusual” location, but it offers you to open them in Finder after they are complete, or just look up your new wrapper by the name you gave it using OSX’s Spotlight. Right-click the wrapper file and select “Show Package Contents”. Inside the package you’ll see ‘Wineskin’ app and the ‘drive_c’ folder with typical Windows folder structure. That’s what you’re going to work with now.

First, launch Wineskin app (the one inside your package). Click “Advanced” button and then select “Tools” tab. There’s lots of useful stuff here if you are a technical mastermind. But if you are not, just hit “Winetricks” button in “Utilities” column.

Type ‘vcrun6’ into the search field. You’ll see a bunch of packages satisfying your search string. Look up the latest service pack available (it was ‘vcrun6sp6’ at the time of writing), click the checkbox, hit “Run”. It will install the base packages it needs.

Do the same for ‘ie6’. This is necessary for the built-in MQL reference in MetaEditor to work.

You could also use Winetricks to install fonts. There’s an “allfonts” option, which might be an overkill, and “corefonts” option, but I’m not sure if it includes Windings font used by MetaTrader. So instead of installing via Winetricks you may manually copy your own set of default fonts into ‘drive_c/windows/Fonts’ folder inside your wrapper.

Install MetaTrader 4

Close Winetricks. Back to main Wineskin screen, hit “Install Windows Software”, select the MetaTrader installer you’ve downloaded and follow its prompts. At the end Wineskin prompts you for the main EXE file, but you can always change that on the ‘Wineskin\Advanced\Configuration’ page. The file launching MT4 is called ‘terminal.exe’.

If you want to set the icon for MetaTrader you can do it on the same ‘Wineskin\Advanced\Configuration’ page. Create your own ‘.icns’ file using OSX’s Icon Composer or feel free to use mine.

When you’re done you may want to copy ‘config’ folder from your existing Windows installation of MetaTrader4. That will transfer your previous server connection lists as well as your MetaTrader account details and layouts. Just make sure you are not trying to connect to one broker’s servers while using an installer from another.

Testing it

Now you can exit Wineskin app and close the Finder window showing your bundle contents. To run MT4 you launch the ‘MetaTrader4’ application bundle generated by Wineskin Winery at the very beginning.

On a cursory look it is an improvement over Crossover version 8 I used back then. Everything seems to be smooth – the interface (drag&drop, fonts, icons and other stuff), charts, indicators, expert advisors (didn’t test DLL import, but can’t see a reason for it not to work) and strategy tester (including visualisation), opening a trade from the market (didn’t test other orders, but again should be alright), MQL editor.

Two things didn’t work for me:

Intellisense/keywords completion in MetaEditor. It opens the popup window, but fails to load the data. What’s promising it doesn’t cause the application to freeze or crash, plus the whole intellisense business worked beautifully for me in MetaTrader 5 under Wineskin, so possibly someone will have another go at it. Even function signature popup works fine as you can see in the screenshot above, but the keyword completion doesn’t for some reason. By the way, to remove the standard OSX window header from the intellisense popup, tick the “Force use of wrappers quartz-wm…” checkbox on ‘Wineskin\Advanced\Options’ page.

F1 help. Pressing F1 causes the application to crash, even though it opens fine from the main menu. But who needs it anyway.

If something goes wrong

If you experience any kind of runtime issues and you are adventurous enough to dive deeper into setup and troubleshooting business, Debug Mode is of great help. Instead of launching the bundle go to package contents, then open ‘Wineskin\Advanced\Configuration’ page and hit “Test Run (Debug Mode)”, replicate the issue and close the program. After that Wineskin will let you check the runtime logs, where you may find a clue to a missing or misbehaving component.

For reference, I used FXCM’s MetaTrader 4 Build 418 with Wineskin Wrapper version 2.5.4 and Engine version WS8Wine1.5.0, OSX 10.6.8 Snow Leopard.