Free MT5 source code

Two conservative trading assistants with visible risk controls

These Expert Advisors automate two transparent, rules-based examples: a trend breakout and a selective range re-entry. Both use completed candles, percentage-risk sizing, spread limits and a daily loss lock.

Includes editable .mq5 source and compiled .ex5 files · MetaEditor: 0 errors, 0 warnings

MT5 Expert Advisors with trend, range and risk-control dashboard
Helper tools, not profit promises. No strategy is stable or profitable in every market regime. Backtests can mislead, and live execution adds spread, commission, swap, slippage and gap risk. Use these EAs for research and decision support; backtest with realistic costs and forward-test on demo before considering live use.
What is included

Simple logic you can inspect

EA 01

TF Donchian ATR Assistant

A completed H4 close outside the prior 55-bar Donchian channel provides the setup. A 200 EMA filters direction; ATR sets the stop and the default target is 2.5R.

  • Default risk: 0.50% per trade
  • Hard maximum: 1.00%
  • 2.00% daily equity-loss lock
  • No averaging down or grid logic
EA 02

TF Bollinger RSI Range Assistant

A completed H1 candle must return inside the Bollinger Band after an RSI extreme. ADX must indicate a non-trending regime; ATR provides the protective stop and the middle band is the target.

  • Default risk: 0.25% per trade
  • Hard maximum: 1.00%
  • 1.50% daily equity-loss lock
  • Minimum reward/risk gate
Risk architecture

What the code does—and does not do

✓ Position sizing: estimates one-lot stop loss with MT5 OrderCalcProfit, then sizes to the selected account-risk percentage.

✓ Entry discipline: evaluates only when a new signal candle begins, using the candle that just closed.

✓ Execution filters: skips entries above the maximum spread, outside the optional time window or when any position already exists on the symbol.

✕ No certainty: a broker may reject orders, gaps can exceed stops, and the daily lock resets from equity seen when the EA is running at the start of a new server day.

Evidence, not marketing

Why these ideas were selected

The trend example is inspired by documented time-series momentum across liquid futures, including currency instruments. That supports the broad phenomenon—not this exact code, parameter set or future return. The range example combines long-established Bollinger, RSI and ADX tools to illustrate a restrictive mean-reversion setup; persistent trends remain its central failure mode.

Installation

Install and test in six steps

  1. Download and unzip the pack.
  2. In MT5 choose File → Open Data Folder.
  3. Copy .mq5 or .ex5 files to MQL5/Experts/Trade-Forex/.
  4. Compile the source in MetaEditor, then refresh MT5 Navigator.
  5. Backtest one symbol and timeframe at a time with every-tick modelling and realistic costs.
  6. Forward-test on demo and compare fills, spread and behaviour with the backtest before making any live decision.
Broker conditions matter

Test with a demo account first

Check regulation, spreads, commission, swap and execution for your jurisdiction. The HFM button is an affiliate link; Trade-Forex.info may receive compensation if you register through it, at no extra cost to you.

Visit HFM via our affiliate link

Educational software only—not personal financial advice or a recommendation to trade. Leveraged products are high risk. Version 1.00 · September 2026.