Mt5 / python bot on virtual machine

Hi all,

Looking to run my python script on a virtual machine.

Had a go tonight and I have no idea what I’m doing - do I need a “desktop experience” (viewable GUI), or can I run it all from the command line?

I was trying the free options, so perhaps its down to the low spec thats available in these packages, but it was so laggy I couldn’t even download chrome browser, nevermind get MT5 running.

Any pointers would be appreciated- never ran a VM before and have only been coding as a hobby a couple of years.

Beyond Tired

Totally get it VMs can be confusing at first, especially with low specs.

You don’t need a desktop/GUI to run a Python script command line is usually faster and way less laggy, especially on free-tier VMs. Just SSH in, install Python if needed, upload your script, and run it.

BUT if you’re trying to run MT5 itself (not just the Python API), that’s a different story it needs Windows and a GUI, which free VMs usually can’t handle well.

Happy to help more if you share what your script’s doing!

Thank you! Tbh I wasn’t even expecting a desktop interface before setting it up, but when I saw a tutorial I was following had one, I slipped into thinking it was going to be easier that way - I was wrong!

I’m using the Python API, so will stick with headless (now I understand that term - thanks).

Simple script for now:

  • connect to mt5
  • gets the high and low of spcified time range
  • checks every bar for a breakout
  • enters a short if the low is broken, long if the high is broken

Improving the strategy isn’t a concern until I know I can run it in a VM :slight_smile:

1 Like

I am happy that I could help. best wishes for you and your trading :slight_smile:

Ok so the journey has progressed -
The good news:

  • I have my script running on the vm and executing on mt5 as it should

The not so good:

  • It turned out I did indeed need to run MT5 itself, so it is a fairly specced Windows vm, which is likely to be costly in future (I have the free joining credits for now)

My plan now is to try downgrade bit by bit to see what the lowest/cheapest option is. I have no doubt I’ll end up in the corner crying attempting the linux/wine method at some point :laughing: - this is fine - as long as I know I can get running on a vm, I can crack on with improving my strategy without the concern of session times, and I’ll meet the vm issue somewhere in the middle overtime :slight_smile:

A little update - I now have a fairly low spec linux vm, running MT5 through wine :slight_smile: I used XFCE and XRDP to get the GUI. And the script has been running consistently for just over a week.
Quite proud with my progress there after hearing on many forums how tricky it can be to get MT5 running on linux.
Now to refine a profitable strategy…!