The "Invalid request" error in your MQL5 Expert Advisor (EA) may be caused by several issues that you should investigate:
-
Incorrect order parameters (SL and TP): Based on the data you provided, you are setting a Stop Loss (SL) at 3109.050 and a Take Profit (TP) at 2109.050. This could be invalid for the current market conditions or your broker's requirements. Make sure that the SL and TP are placed at permissible distances from the current market price and comply with your broker's rules.
-
Invalid trade volume: The volume of 0.03 might not comply with the minimum or step size allowed for this instrument by your broker. Check the minimum and step sizes for XAUUSD in your broker's conditions.
-
Execution timing: If your EA is trying to place an order during periods of low liquidity or when the market price is changing rapidly (e.g., during news events), this may cause the request to be rejected. You could add a delay before retrying to place the order or check if this happens during off-market hours or news times.
-
Price validity: Ensure that you are using up-to-date market prices for XAUUSD when setting SL and TP. Using outdated or delayed prices could lead to this error.
-
Broker server issues: The error could be related to delays or problems on the broker's side. Check if your connection is stable and inquire with your broker about potential server issues.
-
MQL5 error logs: Carefully check the error logs to see exactly where the EA is returning the error. You can also add more debugging information to your EA code to pinpoint the issue.
Check these points, and if none of them solve the problem, it might be a good idea to consult with your broker regarding the specific settings and limitations for XAUUSD orders.
I’ve developed an EA in MQL5 for Gold, where I’m using a 5000-pip SL and TP. However, I’m encountering an issue: initially, the order fails to be placed due to an 'Invalid Request' error, but after several attempts, it eventually goes through. I’m trying to upload this EA to the MQL5 site, but it’s being rejected because of this problem. Could someone please help me identify where I have gone wrong? Thank you in advance for your help!
Thank you so much for your help. I will investigate all the suggestions and share updates here. Many thanks!
Hi I have similar issue with my ea can you please help me out?
Please read this article, I think it can help you.
The checks a trading robot must pass before publication in the Market. https://www.mql5.com/en/articles/2555
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I’ve developed an EA in MQL5 for Gold, where I’m using a 5000-pip SL and TP. However, I’m encountering an issue: initially, the order fails to be placed due to an 'Invalid Request' error, but after several attempts, it eventually goes through. I’m trying to upload this EA to the MQL5 site, but it’s being rejected because of this problem. Could someone please help me identify where I have gone wrong? Thank you in advance for your help!