MQL5 Source Codes of Expert Advisors for MetaTrader 5 - 5

icon

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.

Submit your code

Gold has a daily maintenance break on the CME. The first hour after it rises more than chance explains, in every calendar year of an 11-year sample - while every other hour of the day measures flat. One trade per session, a volatility-scaled server-side stop, no averaging or grid. Then my cost model turned out to be wrong. A real-tick backtest showed the true round-trip cost at the reopen is about 60 points, not the 19 my research had charged - the M1 bar spread field is a per-bar summary and understates it roughly threefold. Re-running 11 years at the corrected cost: +3.34 bps, t 7.40, 59.3% wins -> +1.60 bps, t 3.42, 50.8% wins The edge survives, at less than half its original strength. That second number is the real one. What it is not: about +3.3% a year with 4.6% drawdown, roughly one year in nine negative. At 0.01 lots that is ~130 a year - a figure that measures the position size, not the strategy.

A small educational Expert Advisor showing how a classic Donchian breakout can be applied directly to completed Renko bricks.

Cost is the one input to a trading system that is knowable exactly, and it is almost always estimated wrongly - always in the direction that flatters the strategy. This EA measures what one round trip really costs on YOUR broker: the live spread sampled from ticks, the swap for both sides including the triple-charge day, and the commission read from your own deals. Most spread figures come from the bar's "spread" field, because that is the easy one to reach. It is a per-bar summary, not the quote at any instant. Measured on XAUUSD: 20 points live across 60 readings against a bar-field median of 6. A factor of 3.3. So a filter set to "skip if spread > 15" never fires - it lets through exactly the moments it exists to block. Swap is the half most custom simulators do not charge at all. It is asymmetric, one side pays while the other collects, and one weekday counts three times. Read-only: it never opens, closes or modifies a position.

An Expert Advisor that trades the SuperTrend TV indicator through iCustom on closed bars only, shipped with the audit that proves every trade matches a signal and no signal was missed

Everyone running a grid asks: is my account big enough? The usual answer - the loss at the last grid level - is the wrong number. What ends the account is the margin level reaching the broker's stop-out, while the chain is still open and still looks recoverable. This EA computes the real figure, then counts how often a move that large has already happened on the symbol's own M1 history. Three mistakes it fixes, all erring in the reassuring direction: a chain of N legs floats at step x N(N-1)/2, not step x N (at 10 legs, 45 steps of loss, not 10); open positions also lock up margin while they float; and stop-out is a percentage, not zero - at 50%, losing half the equity is enough. "You need 86 dollars of room" is an abstraction. "A move that size happened 71 times in 100 days, one every 1.4" is a decision. Set InpEquity to a size you do not have yet to see what the configuration would really need. Strictly read-only: it never opens, closes or modifies a position.

A safety EA that watches every open position on the chart symbol: it reports any position left without a stop loss, optionally attaches an ATR-based stop, and enforces a daily and a total drawdown limit that re-arms after a cooldown.

This Expert Advisor is that missing bridge. Attach it to any chart and it periodically writes the calendar to a CSV file in `MQL5\Files`, where anything outside the terminal can read it.

Exporting your deal history is easy and a dozen scripts already do it..

Records the maximum favourable and adverse excursion of every position in R multiples and writes one CSV row per closed trade.

Session-range breakout EA with ATR filtering, stop-distance sizing, optional break-even/partial close, and a shared chart desk. Hedging accounts; educational source with documented execution and coordination limits.

Equity guard that enforces a daily loss limit and a total drawdown limit, flattens the account on breach and blocks trading until the next daily reset. Includes the guard as a reusable include file plus a self-test expert that proves the behaviour in the strategy tester.

A small educational Expert Advisor for MetaTrader 5 showing one simple way to combine classic fixed-size Renko bricks with a SuperTrend-style trend state.

Manage orders, existing orders, limit orders, trailing, break event & Lot size calculator in one tool

A small educational Expert Advisor for MetaTrader 5 showing one simple way to automate support and resistance reactions with internally built classic Renko bricks.

GDS Renko Fast Demo is a small educational Expert Advisor for MetaTrader 5. It demonstrates how two internal fixed-size Renko streams can be used in a simple mechanical trading example without offline charts or custom symbols.

Market Replay Tool is an MT5 utility that seamlessly merges a Market Replay simulator with interactive TradingView-style Long & Short drawing tools. It allows traders to backtest strategies on historical data with adjustable playback speeds, while effortlessly mapping out risk-to-reward setups using dynamic, draggable entry, stop-loss, and take-profit visual boxes directly on the chart.

XAUUSD M15 basket recovery EA with adaptive ATR spacing, LL/LH structure validation, dynamic RSI gating, crash detection, news filter, and smart trade trimming.

An interactive GUI panel for MetaTrader 5 designed for manual traders and quant developers. It automates dynamic position sizing based on exact account equity risk percentage, features one-click order execution (Buy/Sell), instant BreakEven, Close All functionality, and continuous real-time Trailing Stop management.

Quantitative MT5 Expert Advisor that filters market noise using Chaos Theory and the Largest Lyapunov Exponent (LLE). Trades momentum EMA crossovers only during deterministic market regimes, with built-in ATR risk management.

Closes a basket of positions when its floating loss reaches a limit set as fixed money, a percent of balance, or a percent of equity. Scope filters by symbol or magic numbers, optional profit target, safe non blocking retries.

The Hybrid Microstructure EA is an advanced, high-frequency scalping Expert Advisor designed specifically for XAUUSD (Gold) on the M1 timeframe. Unlike traditional indicators that rely on lagging OHLC mathematics, this EA operates on Tick-Level Microstructure Dynamics—tracking tick velocity, volume-weighted average price (VWAP) deviations, and liquidity sweep rejections (stop hunts) executed by institutions.

Using ORB strategy on AAPL cfd

A free, read-only MetaTrader 5 panel that converts your prop firm's daily reset rule (written in whatever time zone the firm uses) into your broker's actual server time, shows a live countdown to the next reset, and warns you before a daylight-saving shift moves the boundary by an hour. Sends no orders, reads no account data, display only.

An Expert Advisor that measures the high/low of a defined session opening window, then trades the confirmed breakout of that range with risk-based position sizing and a one-trade-per-session cap.

Professional open-source Spread Monitor for MetaTrader 5. Displays live spread, minimum, maximum, average spread, history graph and configurable high-spread alerts with a modern Quantora dashboard.

Read-only MT5 history utility that groups partial fills by position identifier and separates gross result from commission, swap, fee, and net result.

Read-only OnTradeTransaction logger that records MT5 order, deal and position lifecycle events to local CSV and the Experts Journal.

Daily Zone Recovery is a multi-strategy trading expert advisor for MetaTrader 5 that operates based on the previous trading day’s high and low levels. The expert advisor monitors price behavior near daily extremes, uses three independent entry strategies, and can manage positions using a fixed-volume grid.

Automatic structure-based SL, breakeven, ATR trailing, and dollar-based profit protection for manual MT5 trades and pending orders on Gold and selected FX pairs.

Free open-source MT5 read-only chart utility that scores current trend conditions and builds broker-normalized long and short risk plans. It uses moving-average direction and slope, ADX, Efficiency Ratio, ATR, spread, account currency and symbol specifications. It never opens, modifies or closes trades.

Set your risk %, drag the stop, and get the exact lot size priced in your account currency — margin and target included. Calculates only, never trades.

On-chart trade management utility for MetaTrader 5 designed exclusively to adjust existing manual or EA positions. Features one-click controls for Break-Even placement, point offsets, profit locking, trailing stops, Risk-to-Reward (1R–3R) Take Profit targets, and volume-validated partial closures (25%–100%). Includes a draggable chart GUI and filtering by symbol and direction. Does not open new trades.

Professional open-source Margin Calculator for MetaTrader 5. Calculates required margin, Free Margin impact, Margin Level, position value and margin safety with a modern Quantora dashboard.

Professional open-source Risk Calculator for MetaTrader 5. Calculates money risk, account risk percentage, potential profit, Reward-to-Risk ratio, margin requirement and risk level.

Professional open-source Position Size Calculator for MetaTrader 5. Calculates broker-compatible lot size using account value, risk percentage, fixed risk amount and Stop Loss distance.

Professional open-source Trailing Stop manager for MetaTrader 5 with adjustable start, distance, step, profit filter, Magic Number filtering and a modern Quantora dashboard.

Professional open-source Break Even manager for MetaTrader 5. Automatically moves Stop Loss to Break Even with adjustable trigger, offset, Magic Number filtering and a modern Quantora dashboard.

Professional open-source trade management utility for MetaTrader 5. Automatically manages Stop Loss, Take Profit, Break Even and Trailing Stop for existing positions while providing a professional real-time dashboard.

An Simple MQL5 trade management panel featuring drag-and-drop chart lines, dynamic lot sizing based on risk percentage, ATR/Point Stop Loss modes, and real-time floating P/L monitoring.

What it does DEMO = unlimited free. LIVE = 7-day trial, then rent GoldScalping Pro on MQL5 Market: https://www.mql5.com/en/market/product/190166 Trades XAUUSD on M5 during London / New York sessions Entry logic: EMA momentum + short breakout/retest filters Exits: ATR-based Stop Loss / Take Profit + optional time-stop Risk: fixed % of equity per base trade Lot scaling: increases only after consecutive wins (capped) — no martingale after losses Daily loss stop and max spread filter Optional local HTTP bridge for a companion mobile/web app (monitor, pause, close, modify SL/TP)

123456789101112...45