tradingalgorithmic-tradingmetatrader5

MT5 and Python Trading Bot


I am relatively new to trading and autonomous trading. I have implemented a trading bot in python (using anaconda navigator and Spyder) where I am using the MetaTrader5 API which is offered.

My bot works perfectly with the MetaQuotes Demo account using the API, but as soon as I want to trade through a broker, then it does not execute the trades.

For now, I can run the bot and execute trades as I wish on the demo account by calling the MT5 API in Python, however the moment I would like to use the same bot (running in Spyder and making the same API calls) through a broker, it doesn't work.

The message the API provides when I try to place the Trade is "Auto-trading disabled by server" but when I check I have enabled everything that should allow me to use my bot on my side (and it works on the MetaDemo account)

Is there something special I have to do to get it to work, or do I have to just write the Python code I have in MQL5 in MetaEditor in order for it to work through a broker?

Any help will be highly appreciated, sorry if this is a trivial question, I am still learning how all of this works.


Solution

  • Firstly, you need to check if your consultant provides support for accessing Metatrader 5.

    By confirming this information, I was able to fix this problem within Tools, Options and checking the Allow Algorithmic Trading option

    [Screen Expert Advisors1