How to Install AmiBroker on macOS using Wine (even on M1/M2/M3)

Wine is getting better and better, to the point that right now you can easily and seamlessly install AmiBroker and use it like any other native application. No need to run Parallels or any real Windows except to download the data. But we will find a way sooner or later to overcome that problem.

Let's install wine and winetricks using HomeBrew, which is the de-facto package manager for macOS these days.

brew install --cask wine-stable --no-quarantine
brew install winetricks
winetricks mfc42

Great! Now download AmiBroker.6.93.0.x64.exe (or the lastest version, but 64 bit) and run:

wine AmiBroker.6.93.0.x64.exe
wine ABReg64.exe

Finally, I suggest you setting the screen resolution to 120 DPI so it will be easier on your eyes

winecfg

That's it! Now you can run AmiBroker and it works incredibly well, including backtesting, reports and everything EXCEPT the communication with AmiQuote

wine "/Users/YOUR_USER_NAME/.wine/drive_c/Program Files/AmiBroker/Broker.exe"

In order to import data, I simply do it under Parallels and then copy the database to the "/Users/USER_NAME/.wine/drive_c/Program Files (x86)/AmiBroker/databases" directory.

I know it's not the same as having a real Windows or Parallels, but for my use case I don't need to update the data more than once per week, so I can play with strategies and backtests directly from my Mac without the need to having a full Windows VM loaded all the time.

Cheers!
MagicMac

5 Likes

Great contribution.

As to inter-app communication: it is because WINE does not implement Windows OLE automation.

2 Likes

Unlike my 15 year old boy, I'm not familiar with wine :laughing:, but a quick search leads me to believe that we might make this work because OLE seems to be implemented.

Maybe there's a way to make it work, or create a patch/script to allow the communication between AmiQuote and AmiBroker. So far, I'm happy working a bit from within Wine because I'm getting the data from a shared NAS that updates the quotes from a real Windows. But I won't give up on this one!

Thanks Tomasz!

I don't think it is implemented correctly. Even their own web site says https://source.winehq.org/WineAPI/oleaut32.html it is only 93% of functions implemented.
It seems that critical function DispFuncCall is not implemented by WINE. Without this function OLE function/method calls can't be made. Maybe winetricks oleaut32 or some other "trick" will do, but I am not wine expert or even user at all.

1 Like

After a month using AmiBroker on Wine and Parallels, I can confirm that using it in Wine is pretty comfortable but the speed is clearly different. Maybe the test is not as realistic because in Wine I've installed the x86 version while on Parallels I have the 64 bit one. Same on a real PC where I have the 64 bit version installed. In any case, you can judge the results by yourself, but it's clear that Parallels running on the Mac M1 Pro beats both Wine on the same machine and a real -inexpensive- PC.

Take a look at the results of a quick individual back-test of 2000 symbols over 2 years of data

My conclusion is that for quick tests, Wine is good enough, but if you are going to get serious it's better to run AmiBroker in Parallels, which works incredibly well.

1 Like

FYI: 64-bit version is about 50% faster than 32-bit, natively on Windows x86/x64 architecture.

And in your benchmark, it is quite clear that PC is twice as fast as Mac when doing pure computation (look at "AFL" numbers). Where Mac wins is data access time (most likely thanks to higher RAM bandwidth). As data access time is orders of magnitude higher than actual computation in your test, the Mac numbers look slightly better.

Wow!!! I take my words back regarding Wine! After installing AmiBroker x64, the speed went up dramatically! :laughing:

Here's the updated comparison. Wine/AB x64 have similar speed to the Parallels version, and it's well integrated as if it were a macOS app.

And Tomasz! AFL ran even faster than the real PC!!

Please, feel free to edit my first post indicating that x64 is the correct version to be installed!

I guess that 32-bit code in 64-bit WINE on ARM goes thru some "double" emulation layer (possibly x86->x64->ARM) - that would explain dramatic difference.

Yeah, you are likely right Tomasz. In any case, it still feels magic that a triple conversion of low level instructions exist and nothing gets broken in the middle. I'm sure it's pretty complex =). Memory, registers, instructions... not easy!

BTW, Tomasz, I was thinking last night that at this speed, AmiBroker is perfectly usable on macOS and of course, Linux as well. IMHO there's still one missing piece, and it's the connection with AmiQuote or something, an interface or script not based on OLE which could convert the data gathered by AmiQuote to an AmiBroker database. At the end of the day, AmiQuote works perfectly fine under Wine, it's just that it can't connect to Ami in order to pass the updated symbol data.

Is there any alternative way -even if manual- to convert the data gathered by AmiQuote to AB database format? Right now what I'm doing is simply run AmiQuiote inside Parallels once every week and then override the database from Wine. This allows me to work perfectly well in Wine without the need to having a full VM all day.

Thanks!

I dont have a setup to test this, but are you able to use File > Import ASCII
sorry if it sounds dumb but I am unable to test myself
then you could just add aqu1.format and import all the files
as you asked for manual method and frequency is weekly

1 Like

Of course there is a way, ASCII import. In fact automatic import is nothing more than AmiQuote triggering import using OLE interface, but ASCII import can also be done from UI and also from batch.

You can either use predefined format or create your own import format, it is described in detail:

https://www.amibroker.com/guide/w_impwizard.html

This is just to be done once, later on you can just use File->Import ASCII directly.

1 Like

Thanks for sharing the details @magicmac .

Is it possible to run ODBC drivers from within wine on Mac? I'd like to connect Amibroker to a Mysql DB datasource via ODBC

My pleasure, @tradecap. I've been using AmiBroker within Wine for a couple of months now, and it works beautifully. I did not connect AmiQuote neither imported databases so far. I use Yahoo! EOD so I simply update the database every Friday from within a Parallels and then just copy it to my wine/c/Amibroker folder.

Regarding ODBC, I haven't tried but according to the official Wine documentation, it should work fine.

Good luck and let me know how it went! :slight_smile:

That winhq page has a lot of great details. Thanks for pointing me to it @magicmac. I tried crossover, native ODBC MySQL driver (32 bit only) installs but does not work. Vmware Fusion works fine but Windows on ARM supports 32 bit ODBC drivers only. Will try the ideas listed on the winehq page over time but I'm using a Windows remote desktop for now.

1 Like