How Expert Advisors (EAs) Actually Execute Trades on MT5

7/9/2026

An Expert Advisor doesn't run continuously in the background thinking — it reacts to events. The core event most EAs hook into is OnTick(), which fires every time the terminal receives a new price quote from the broker for the symbol the EA is attached to. On a fast-moving pair during an active session, that can mean the EA's logic is evaluated many times per second; during quiet hours, ticks slow to a trickle. On each tick, a typical EA runs through a decision chain: check whether it's already in a position on this symbol, check whether entry conditions are met if it's flat, check whether exit or management conditions are met if it's in a trade, and — critically — check risk constraints before doing anything else, like maximum open positions, maximum daily loss, or a news-time filter that pauses trading around high-impact economic releases. Once a decision is made, the EA sends a trade request to the terminal, which forwards it to the broker's server. This is where slippage and requotes live — the price the EA requested and the price the broker's server can actually fill at may differ by the time the request arrives, especially during volatile conditions. A well-built EA handles this gracefully: it checks the returned result code, retries sensibly on a transient error, and never assumes an order succeeded just because it was sent. This is also exactly why infrastructure matters as much as strategy logic. An EA running on a home PC that sleeps, loses internet, or sits three time zones and 150 milliseconds away from the broker's server is working with a real handicap compared to the same logic running on always-on infrastructure close to the broker — the strategy can be identical and still perform differently purely because of where and how reliably it executes.