Expert Advisors analyze price charts and trade automatically following underlying rules. Here you can find MQL5 source codes solving a variety of problems. You are able to select both simple Expert Advisors based on moving average crossing and complex ones involving complicated signal generation algorithms and protection against trading mistakes.
You can download and launch offered Expert Advisors in MetaTrader 5. It is recommended that you test and optimize trading robots in the Strategy Tester before using them. The library of Expert Advisors is also available directly from MetaTrader 5 platform and MetaEditor development environment.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Enable two-factor authentication ContinueTrend-following breakout EA using a Gaussian-filtered channel, ATR bands, risk-based lot sizing, and an R-multiple trailing stop.
Manual one-click trading panel for MetaTrader 5. Calculates the lot size from your risk % and stop loss (always rounded down), places SL/TP by pips and reward:risk, and manages trades with breakeven, trailing stop and Close All (only its own trades). Shows balance, equity, spread, floating P/L and an Asia / London / New York session tracker. No trading strategy inside: trades open only when you click BUY or SELL.
JPN225 Yen Check is a free, fully open EA for the Nikkei 225 on M30. It buys when the Nikkei is holding near the top of its recent range, but only if it hasn't run too far ahead of GBPJPY. Everything is closed by 17:00 server time. Four conditions, long only, one trade at a time, a stop loss on every trade.
Donchian channel breakout Expert Advisor with EMA trend filter, ATR stop, ATR trailing stop, break-even and position size from risk % of balance.
Protects prop firm challenge and funded accounts: watches equity in real time and closes all trades before the daily loss or maximum loss limit is broken, with an optional profit target lock and a live progress panel.
Structural Swing Migration BUY is an educational Expert Advisor for MetaTrader 5 that opens BUY positions when confirmed swing highs and swing lows move upward together. It evaluates closed M15 candles and combines structural confirmation with a volatility threshold and a bullish candle filter.
Prop Firm Equity Guard protects prop-firm challenges and funded accounts. It monitors live equity against your daily loss and max drawdown limits, then closes all positions, deletes pending orders and locks trading before the firm's limit is hit. A safety buffer makes it act early, and anything opened while locked is closed instantly. It supports static and trailing drawdown, an optional profit target lock and alerts, saves its state through restarts, and shows an on-chart dashboard with room left and a reset countdown. It works alongside manual trading and other EAs.
Account guard for prop-firm challenges. It does not open trades: it watches the whole account (manual trades and any EA) and closes everything before the firm's limits are broken. - Daily loss limit: closes all and blocks trading until the next day. - Max drawdown: static or trailing (can lock at the start balance); closes all and locks the account. - Optional profit-target lock, max lots / max positions, Friday close. - On-chart panel (equity, today's P/L, daily and drawdown room left) and push alerts. - Equity peak and lock are saved per account, so a restart does not reset the protection. Main inputs: StartBalance, DailyLossUSD, DDMode, MaxDDUSD, LockAtStart, safety buffers, TargetUSD, MaxOpenLots, MaxOpenPositions, FridayCloseOn, ResetLock. Attach to any one chart, any symbol and timeframe, with Algo Trading enabled.
A bolt-on module (.mqh) plus a ready integration example: a news filter that keeps your EA out of new entries around economic releases — using only the built-in MT5 calendar, no DLL and no WebRequest — and a slippage log that records, for every fill, the difference between the price you asked for and the price you got.
Scans the trend on M5, M15, H1, H4 and D1, shows market bias, volatility, session and previous-day levels in one clean panel, and opens trades with one click using a risk-based lot, ATR stop loss and R:R take profit.
Free MT5 research EA with three closed-bar entry models, ATR stops, fixed-R targets and a tester cost ledger. Version 2.31 uses the chart symbol and timeframe. Historical research: XAUUSD M5. Educational source; published tests were loss-making.
Starts a trailing stop when the price reaches the take-profit zone of a position you already have open. The take profit is removed, extended or kept. It never opens trades.
A simple account guard: once the day's loss (equity against the balance at the start of the day) reaches your limit, it closes all positions, deletes pending orders and keeps the account flat until the next day. Works on manual trades and on any EA. Never opens trades.
Moves the stop loss of open positions to break-even plus a small locked profit once they reach a profit trigger. Works on manual trades and on trades from any other EA (magic filter). Never opens or closes trades and never moves a stop backwards.
Moves the stop loss to break-even and then trails it on trades that are already open. It never opens or closes a trade.
Daily loss limit and daily profit target for the whole account (prop firm style). When a limit is hit it closes positions, deletes pending orders and keeps the account flat until the next daily reset.
Risk-based lot size panel: risk (% of balance, % of equity or money) and stop loss in points give the lot. Shows money at risk, reward and margin and opens BUY / SELL with SL and TP in one click.
Drag a stop-loss line and read the lot size for your risk. The loss per lot comes from OrderCalcProfit, so the size is right on metals, indices and cross pairs. Shows the real risk after rounding, the margin and an R-multiple take profit. Places no orders.
Moves the stop loss of already open positions (manual or from any EA) to break-even and then trails it by points or ATR. Never opens or closes trades, only moves the SL in your favour.
Devil Trader AI Lite is an automated Smart Money & Liquidity Expert Advisor engineered exclusively for GOLD (XAUUSD) on M30 and H1 timeframes. It maps Major Demand and Supply Order Blocks, waits for confirmed rejection candles, and applies dynamic ATR Stop-Loss, auto-lot sizing, and trailing stop protection with zero Martingale.
Seven-Bar Pressure Flip (SBPF) is a sell-only Expert Advisor for MetaTrader 5, provided as a research example for XAUUSD on the M15 timeframe. It looks for a bearish reversal candle following positive average candle-body pressure and manages positions using ATR-based stops, a fixed reward-to-risk setting, and a bar-count exit.
Intraday momentum EA for the Nasdaq 100: trades breakouts of a noise band around the New York open (rules of Zarattini, Aziz and Barbon, 2024), exits inside the band or across the session VWAP, flat at 16:00 New York.
A lightweight MetaTrader 5 Expert Advisor that records new-bar events and terminal connection-state changes to a local CSV file. Designed for developers and traders who need reliable event logging, diagnostics and monitoring without executing trades.
Free Expert Advisor that watches a basket of open positions (all, by Magic number or by symbols) and closes the whole basket when floating loss or profit reaches a set percent of balance. Works next to any EA or manual trading.
Part 4 of the regression-testing series. An Expert Advisor that builds a fixed matrix of 20 valid and invalid trade requests (stops at and inside the stops level, wrong-side stops, volume outside the symbol rules, oversized and unknown closes, unchanged and wrong-side modifications), checks each one with OrderCheck() without sending anything, and reports PASS, FAIL or INCONCLUSIVE per row with a digest you can compare between runs.
Utility EA that moves the stop loss of positions you already have open: break-even with locked profit and trailing stop in points or ATR. It never opens trades.
Utility EA that closes all positions (and optionally deletes pending orders) when the total floating profit reaches your target or the total floating loss reaches your limit, in account currency. It never opens trades.
News trading EA for Gold (XAUUSD) and forex: places a Buy Stop and a Sell Stop seconds before each release of the MT5 economic calendar, one cancels the other, stop loss, take profit and trailing in points. Open source code.
Daily loss limit EA for MT5 on prop firm and funded accounts, Gold (XAUUSD), forex and indices: closes every position at the daily loss or profit limit, deletes pending orders and locks trading until the next day. Open source code.
Opening range breakout EA for MT5 on Gold (XAUUSD), forex and indices: trades the first candle that closes outside the opening range, stop at the range, target in multiples of the stop, lot by risk, end of day close. Open source code.
Trails the stop loss of open positions with one of seven methods plus a break-even that includes the commission. Moves a stop only on a real improvement, never back, respects stop and freeze levels, limits requests. Restart-safe.
An Expert Advisor for MetaTrader 5 that prints one line each time one of its event handlers runs, on a chart, in the Strategy Tester and during an optimization. It never trades.
Gold EA: breakout of the first H4 candle with confirmation via a retest, fixed percentage stop and target, risk-based lot size and drawdown protection.
Utility EA that moves the stop to break-even plus a small lock once a trade reaches +X R, then trails it N R behind price. Manual trades or any EA by magic number. Never opens trades and never widens a stop.
Open-source gold EA built on XAUUSD's multi-day trend persistence: H1 Donchian breakout in the direction of the D1 EMA slope, 3×ATR hard stop, break-even at +1R. Fixed lot, one position, no grid, no martingale.
Blocks new trades on US CPI and FOMC days (New York date). Built-in calendar 2015-2027, works in the Strategy Tester. Never opens trades.
Closes the newer side when a buy and a sell are open on the same symbol (manual trades or any EA). For prop firm accounts that forbid hedging. Never opens trades.
Night session range breakout for XAUUSD: one decision per day, a hash-chained journal written before every order, and safe recovery after restarts.
Trade manager for manual trades and other EAs: moves the stop to break-even at a chosen R multiple, closes part of the position at a second target, then trails the stop in steps. Survives terminal restarts.
Account-wide protection for prop firm and funded accounts: enforces a daily loss limit and a maximum overall loss (FTMO-style), closes all positions and blocks new trades when a limit is hit, with an optional profit target.