AutoTrading disabled by server error message

 

I'm writing an EA using mql5. It works fine when I use MetaQuotes Demo Account but when I switch to my brockers' demo account. It throws an error message in the journal when it opens positions:

13:00:12.294 Trades '45767': failed market buy 10 EURUSD sl: 0.99529 [AutoTrading disabled by server]


This is my buy function. What might be the issue?

void buy()
  {
//The code to make a buy order goes here
//--- zeroing the request and result values
   ZeroMemory(request);
   ZeroMemory(result);

//--- parameters of request
   request.action   =TRADE_ACTION_DEAL;                     // type of trade operation
   request.symbol   =Symbol();                              // symbol
   request.volume   =lotSize();                             // volume of lotSize
   request.type     =ORDER_TYPE_BUY;                        // order type
   request.price    =SymbolInfoDouble(Symbol(),SYMBOL_ASK); // price for opening
   request.deviation=5;                                     // allowed deviation from the price
   request.magic    =EXPERT_MAGIC;                          // MagicNumber of the order
   request.sl       =request.price-(elephant*decimals);

//--- send the request
   if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());   // if unable to send the request, output the error code
   else
     {
      uptrend = true;
      slLevel = 0;
      int total=PositionsTotal();
      orderPrice = SymbolInfoDouble(Symbol(), SYMBOL_ASK);

     }
//--- information about the operation
   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
  }
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Account Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Ask your broker it controls the server or choose another one even only to check your EA. MQ offers (only!) demo accounts...
 
Carl Schreiber #:
Ask your broker it controls the server or choose another one even only to check your EA. MQ offers (only!) demo accounts...
All the brockers told me that autotrading is enabled in their servers and I should contact the person that gave me the bot.(I coded the bot myself). Which made me think that there's some technical error in my code.
 
Change your broker
 
amando #:
Change your broker
Thanks, I'll try all the available brokers.
 
samson kumeni #: Thanks, I'll try all the available brokers.

Don't do that! Select a few few choice brokers only.

Make sure they are regulated (verify with the regulator), licenced (verify that the license is real and still valid), and reputable.

Then select by the types of markets and conditions they offer for the trading you wish to do.

 
Fernando Carreiro #:

Don't do that! Select a few few choice brokers only.

Make sure they are regulated (verify with the regulator), licenced (verify that the license is real and still valid), and reputable.

Then select by the types of markets and conditions they offer for the trading you wish to do.

Okay and thanks.
 
My broker told me to use Metatrader 4 instead of Metatrader 5. It worked. Thank you all for the assistance.