Problem with Expert Advisor execution

 

Hi Guys,

Is it possible to place orders via your EA using a demo account?

When I try to place orders I get this error:

sell: Order has not been completed -error 4752

ERR_TRADE_DISABLED 4752 - Trading by Expert Advisors prohibited

I have 1000 equity in my demo account.

Maybe my broker doesn't give to place orders via EA? 

Thanks

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 

There is no problem to place orders on a demo account, but you have to enable Automatic trading.

See "Auto-trading" button on this page.

 
angevoyageur:

There is no problem to place orders on a demo account, but you have to enable Automatic trading.

See "Auto-trading" button on this page.

Yes I did that. I pressed Auto Trading button and left MetaTrader 5 software. Next day when I came back I got this error 4752. 
 
chevanton1988:
Yes I did that. I pressed Auto Trading button and left MetaTrader 5 software. Next day when I came back I got this error 4752. 

Did you enabled Auto trading in EA settings (accessible by F7) ?

See also this topic, maybe that helps.

 
angevoyageur:

Did you enabled Auto trading in EA settings (accessible by F7) ?

See also this topic, maybe that helps.

AutoTrading is allowed  in EA settings. But I found in Tools > Options (Ctrl+O) in Expert Advisors tab this mark options:

Allow automated trading:

Disable automated trading when the account has been changed

Disabled automated trading when the profile has been changed

 

Maybe, I need unmark them and leave only Allow automated trading.  

 

Today my Expert Advisor condition are not realised and EA doesn't activate because that error doesn't appear.

 
If still not working then try other MT5 platform from MetaQuotes to check if EA is the issue or broker. If EA is working okay then you need to ask broker why EA is disabled -- they can enable it from their side (I have seen like this before).
 

I get ERR_TRADE_DISABLED (4752) "Trading by Expert Advisors prohibited" after migration to VPS (Virtual Private Server MQL5 London LD4 15). Before migration, my Expert Advisor had been running successfully on my laptop for 3 months. When migrating, message "migration successful" appeared, and button "AutoTrading" (and EA icons in top right corner of each chart) fell disabled, as the Expert Advisor was no longer executed on my laptop, but on the VPS. Also log output confirmed it was now running on VPS. But when my Expert Advisor tried to carry out a trading action (PositionClose in this case), it failed with ERR_TRADE_DISABLED. When I press F7 in order to see EA’s properties, checkbox "allow AutoTrading" is checked. VPS "Journal" tells "trading has been enabled". MetaTrader "Journal" tells "you cannot migrate more than 32 charts" (it was 37 charts).

When I click button "AutoTrading", it immediately executes the desired trading action, but I am sure it does so triggered from my laptop, not from VPS.

I payed 50$ for VPS, now I please want to use it. How can I enable AutoTrading on VPS without enabling it on my laptop? And is my assumption correct at all, that after migration, the MetaTrader running on my laptop merely serves as a display terminal of the Virtual Private Server in London? Does it also serve as an input terminal? How can I tell for sure that a trading action was triggered by VPS and not by laptop, while I have never seen the VPS successfully carry out a transaction during the time when laptop was switched off? I have never before used VPS and maybe my expectations of what it does are completely wrong, but I am sure that it would not cost 50$ if trading would be disabled on it, would it?

 
FuryPferd #:

I get ERR_TRADE_DISABLED (4752) "Trading by Expert Advisors prohibited" after migration to VPS (Virtual Private Server MQL5 London LD4 15). Before migration, my Expert Advisor had been running successfully on my laptop for 3 months. When migrating, message "migration successful" appeared, and button "AutoTrading" (and EA icons in top right corner of each chart) fell disabled, as the Expert Advisor was no longer executed on my laptop, but on the VPS. Also log output confirmed it was now running on VPS. But when my Expert Advisor tried to carry out a trading action (PositionClose in this case), it failed with ERR_TRADE_DISABLED. When I press F7 in order to see EA’s properties, checkbox "allow AutoTrading" is checked. VPS "Journal" tells "trading has been enabled". MetaTrader "Journal" tells "you cannot migrate more than 32 charts" (it was 37 charts).

When I click button "AutoTrading", it immediately executes the desired trading action, but I am sure it does so triggered from my laptop, not from VPS.

I payed 50$ for VPS, now I please want to use it. How can I enable AutoTrading on VPS without enabling it on my laptop? And is my assumption correct at all, that after migration, the MetaTrader running on my laptop merely serves as a display terminal of the Virtual Private Server in London? Does it also serve as an input terminal? How can I tell for sure that a trading action was triggered by VPS and not by laptop, while I have never seen the VPS successfully carry out a transaction during the time when laptop was switched off? I have never before used VPS and maybe my expectations of what it does are completely wrong, but I am sure that it would not cost 50$ if trading would be disabled on it, would it?

Autotrading is always enable in MQL5 VPS.

The trades may disabled by your broker:
- for the trading account,
- or for the symbol according to specification of the symbol (it is related to the brokers too).

Besides, dll is prohibited for EA in MQL5 VPS so if your EA is using (or trying to use) dll - this EA will not work on MQL5 VPS (but ERR_TRADE_DISABLED has nothing to do with it).

 
Thanks for your prompt reply, Mr. Golubev. I have written to my Broker (ActivTrades), waiting for their reply now. However, I consider it quite unlikely that their ActivTradesEurope-Server even knows whether the trading request comes from MQL5 VPS in London or from my laptop in Germany. As mentioned before, both trading account and specified Symbols (Infineon and Linde in this case) worked (and still work) without problem before migration. To me it seems that the most promissing trace leads to London. Would it help if I sent the log files?
 
Short intermediate update after digging deeper into log files and having talked to ActivTrades' technical support: before and after the trading transaction which failed with ERR_TRADE_DISABLED, other trading transactions were successfully triggered from VPS, but on other Symbols (other than Infineon and Linde). Currently the most likely hypothesis is that during migration the already opened positions were not migrated along to VPS, in other words: the EA running on VPS seems not to be aware of the positions already opened earlier by EA running on my laptop on same symbol. So when EA running on VPS tries to PositionClose(), it fails because on VPS there is no position to close. I still don't understand why it would fail with such misleading error message like ERR_TRADE_DISABLED, but I'll keep on digging deeper into the matter.  
 

need to check this if its not checked maybe that is the problem

Reason: