Download MetaTrader 5

OrderSend Error 4109 - Trade is not allowed.

To add comments, please log in or register
Richard Read
336
Richard Read  

Hi there,


I manage a number of VPS's with EA's installed on them using. All using the same EA. I come across a problem where some of the EA's will give a 4109 error when trying to open trades. This does not make sense to me as I have allowed live trading in the options and the EA settings, I have AutoTrading on, and I am 100% confident that from an MT4 settings perspective everything should work fine.

I have also contact the brokers where I find this error, and all of them claim it is due to the settings on the MT4 platform. This also does not make sense as all the VPS's I run use the same image, and the same settings for MT4. Most are able to trade without any problems, but some have this issue.


The only thing that I can think of is that I have 2 charts running. On chart 1, I have the actual trading EA. On chart 2, I have another EA, which monitors the activity of chart 1, and if the EA has stopped working, it applies a template to reload the EA on chart 1. This is a fail safe to ensure that i have EA 1 loaded 24/7. This same setup is applied across all MT4's / all VPS's. Is it possible that there is something in the privileges of applying this template that would prevent live trading even if all settings are correct?


Other than this possibility I am completely stumped as to why I would get a 4109 error on some accounts and not others.


Any thoughts or advice would be highly appreciated!

Alain Verleyen
Moderator
33803
Alain Verleyen  

Live trading and DLL imports permissions cannot be extended for the Expert Advisors launched by applying the template using ChartApplyTemplate() function.

If the mql4 program calling ChartApplyTemplate() function has no permission to trade, the Expert Advisor launched via the template will also not be able to trade regardless of the template settings.

If the mql4 program calling ChartApplyTemplate() function has permission to trade, while there is no such permission in the template settings, the Expert Advisor launched via the template will not be able to trade.

ChartApplyTemplate - Chart Operations - MQL4 Reference
ChartApplyTemplate - Chart Operations - MQL4 Reference
  • docs.mql4.com
ChartApplyTemplate - Chart Operations - MQL4 Reference
Richard Read
336
Richard Read  

Thanks Alain!


So calling ChartApplyTemplate() from a different EA is going to cause a problem then. This should not be the case if I call the function from the EA I want to trade correct? 

Alain Verleyen
Moderator
33803
Alain Verleyen  
Richard Read:

Thanks Alain!


So calling ChartApplyTemplate() from a different EA is going to cause a problem then. This should not be the case if I call the function from the EA I want to trade correct? 

It should not be a problem is you call ChartApplyTemplate() from an EA which has trading privileges AND your template has trading privileges enabled.
Richard Read
336
Richard Read  
Alain Verleyen:
It should not be a problem is you call ChartApplyTemplate() from an EA which has trading privileges AND your template has trading privileges enabled.


Hmm yea its strange, The trading EA creates the template (so it should therefore have privileges), and the EA applying the template also as trading privileges. So it doesn't make sense why I would still get a 4109.


Any way to check if a template has trading rights?

Alain Verleyen
Moderator
33803
Alain Verleyen  
Richard Read:


Hmm yea its strange, The trading EA creates the template (so it should therefore have privileges), and the EA applying the template also as trading privileges. So it doesn't make sense why I would still get a 4109.


Any way to check if a template has trading rights?

Apply your template to an empty chart and see if the EA has live trading enabled.
Nguyen Nga
11462
Nguyen Nga  

Error 4109 because you not enable AutoTrading.

Before apply template file, you must enable AutoTrading, if not, your EA will not "Allow Live Trading".

Richard Read
336
Richard Read  
Alain Verleyen:
Apply your template to an empty chart and see if the EA has live trading enabled.

Yes it does, smiley face, and allow live trading in EA & MT4 settings. So It seems the template does have trading privileges, guess I am back to the drawing board as to why it gives 4109 errors on some accounts.
To add comments, please log in or register