ERROR 4051 TRADE DISABLED TICKET=-1

 

I am running my EA in different DEMO and LIVE platforms working fine in all of them except for 1 at FXCM live.

I adjusted settings to work the same in all platforms but keep getting:

- Trade disabled

- Ticket=-1 intead of a regular ticket as happens with the other brokers

Error 4051

I cannot understand how come the EA works perfectly fine in other brokers, even in the FXCM DEMO but not in the FXCM live.

 
Are you checking function return values and reporting errors back to the logs ?
 

Yes and the error is 4051

 
Well according to https://docs.mql4.com/constants/errors/ a 4051 is an "Invalid function parameter value" so I would venture to guess that one or more of the parameters you are submitting is not accepted by your broker. For example, my broker does not allow me to submit a Take Profit and Stop Loss with an Open Market Execution. After the order is submitted, I can edit the order and add a SL and TP, but not before; it would result in a 4051.
 
octriano:

Yes and the error is 4051

Cool, can you show the line of code, and any code associated with any variables used in that line of code, that is responsible for reporting this error to the log please.
Reason: