Stop Chasing Phantom Orders: The Real Reason Your MQL4 OrderSend Fails (And How to Fix It)
Camovia Tray Team · 2026-09-17
Most EA developers have been there. You write your trading logic, carefully set up the OrderSend() parameters, run the backtest, and everything works flawlessly. The Strategy Tester shows order after order filling instantly. You deploy it live, and then the silence. No trades. Or worse, a bunch of -1 returns and error codes you've never seen before.
You are not alone. After reviewing dozens of "working" Expert Advisors over the years, the same structural issues keep surfacing around OrderSend() . The most pervasive misconception is that submitting an order in MQL4 is a simple fire-and-forget operation. The reality, especially in live market conditions, is far more complex.
The function signature itself looks straightforward:
int OrderSend( string symbol, int cmd, double volume, double price,
int slippage, double stoploss, double takeprofit,
string comment, int magic, datetime expiration,
color arrow_color); The trap begins with the most notorious error: Error 130 – Invalid Stops. Many developers believe this only relates to an incorrect stop-loss or take-profit distance. The official MQL4 documentation states that stop levels simply cannot be too close to the current market price. However, the root cause is often more nuanced .
The first major issue is failing to fetch the minimum stop level dynamically. You cannot hardcode a value like 20 pips and assume it will always work. Brokers can change their requirements, and MODE_STOPLEVEL can be a floating value that changes with market volatility . You must query it at runtime using MarketInfo(Symbol(), MODE_STOPLEVEL) . If this value is 0, it might mean no formal restriction, or it could indicate the server employs dynamic level control—which can still trigger Error 130 .
The second, more insidious issue is price normalization. You cannot just calculate Bid - StopLoss * Point and send it. The documentation explicitly warns that calculated or unnormalized price cannot be applied . You must wrap every price calculation in NormalizeDouble(price, Digits) . Most developers get the calculation wrong for a BUY order. The stop-loss is set relative to the Bid, but the open price is based on the Ask . Failing to account for this spread difference in your logic can lead to subtle calculation errors that also trigger Error 130 .
The third and most critical structural failure is ignoring the return value. In the Strategy Tester, orders always fill. In live trading, they do not. Requotes, margin failures, and trade context busy conditions happen constantly . A pattern I see in countless code reviews is this :
OrderSend(Symbol(), OP_BUY, 0.10, Ask, 3, sl, tp); This code is dangerous. It assumes the trade was successful without checking the ticket number. If the order fails, your EA's internal state diverges from reality. The solution is to check the ticket value and validate the order's existence :
int ticket = OrderSend(Symbol(), OP_BUY, 0.10, Ask, 3, sl, tp);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
return;
} How Camovia Tray Changes the Game
The constant stress of monitoring and managing active trades is where Camovia Tray comes in. Once your EA successfully submits an order via OrderSend(), you still need to watch the open position—tracking its floating profit and knowing when to intervene. Camovia Tray transforms your MT4 into a system tray tool, so you can check live quotes and manage positions instantly without even opening the terminal [Product Knowledge]. This is especially useful for those moments when your EA fails to submit an order and you need to take manual action quickly.
Without needing to alt-tab into the MT4 interface, you can view all open positions in a floating order window. It shows you the key details: instrument, direction, lot size, open price, and current profit/loss [Product Knowledge]. From the tray, you can view your current exposure and even close a position with a click [Product Knowledge]. It effectively turns your MT4 into a background service, allowing you to monitor the execution of your OrderSend() functions without being locked to the platform interface.
Building a Production-Ready EA
The conversation around OrderSend() needs to shift from "how to send an order" to "how to ensure an order is sent." A production-ready EA assumes that every trade request can be rejected . Before calling OrderSend(), refresh the rates with RefreshRates() to ensure your price data is current and query all symbol properties like the minimum stop level dynamically . After sending, you don't just check for -1, you should reconcile the EA's state with the account's actual state—especially in grid or martingale systems .
The Strategy Tester is a safe environment where things work. Live trading is the environment where things fail . By rigorously checking return values, normalizing prices, and respecting dynamic broker rules, you can turn a fragile script into a robust EA. And with tools like Camovia Tray, you can add a layer of convenience to this process, ensuring you can monitor your trades and manage your positions from anywhere on your desktop, keeping your data safe and local [Product Knowledge].
MT4/MT5 Tray Assistant
Silent tracking, one-click close - check quotes and manage positions right from the tray.
Download Camovia TrayFrequently Asked Questions
How do I report issues or contact you?
Send an email to [email protected].
Where are the privacy policy and user agreement?
The "Privacy" and "EULA" links in the footer of this site, with GDPR/CCPA information included.
What is Camovia Tray?
A tray assistant for MT4/MT5 - silent tracking, one-click close: hover the system tray to check the latest quotes and manage open positions (click an order to close it), hide the MT5/MT4 main window in one click, and keep quote and position data entirely on your computer.
Do I need MT5/MT4 installed? Does the terminal need to stay open?
Yes. Camovia Tray reads quote and position data from your locally running MT5/MT4 terminal, so the terminal must be installed, running, and logged in. MT5 connects directly with no EA; MT4 needs the bundled bridge EA attached once (one-click copy in Settings, then double-click in the Navigator - see the docs).
Popular Symbols Trading Hours
Open/close times, weekend hours & live market status:
Related Articles
MT4 Technical Analysis Tools for Beginners: What Works, What Doesn’t, and How to Actually Use Them
Learn MT4 technical analysis tools for beginners with simple strategies. Use Camovia Tray to manage trades from your system tray and keep data local.
MT5 "Corplist" Frustration? Why the Broker Search Is Broken and How to Fix Your Workflow
Struggling with the MT5 broker search list? Camovia Tray turns your terminal into a tray tool for quick quotes and position management, keeping data local.
MT4 vs MT5: Which One Should You Use in 2026?
Turn your MT5 or MT4 into a tray tool with Camovia Tray—check live quotes, manage positions, and keep data local. No more full-terminal interruptions.
Understanding MT4 Subwindows: A Trader's Guide to Multi-Pane Analysis
Learn what MT4 subwindows are and how multi-pane analysis improves trading. Camovia Tray lets you check quotes and positions without keeping MT4 open.
MT5 Risk Management Tools for Prop Traders: What Actually Works?
Discover how MT5 risk management tools can improve your prop trading workflow. Camovia Tray offers local, fast access to quotes and positions.