A simple, fully commented trend-following Expert Advisor for MetaTrader 5. It opens a trade when a bar closes beyond the highest high or the lowest low of the previous N bars (Donchian channel breakout). An optional EMA filter allows longs only above the EMA and shorts only below it.
Signals are calculated once per bar on the closed bar, so testing with "Open prices only" and "Every tick" gives the same entries. The EA keeps one position per symbol and magic number, so it can run on several charts at once.
Risk and exits
Inputs
Example: XAUUSD H1, January 2024 - October 2026, default inputs, 0.5% risk per trade: 428 trades, profit factor 1.40, maximum equity drawdown 7.8% (balance chart attached). A large part of this result comes from the 2024-2026 gold rally; other symbols and periods will differ. H1-H4 timeframes on trending instruments suit the idea best. Past results do not guarantee future results; test on a demo account first.
InputRules: Rules Between Inputs and the Share of Passes They Reject
A library for MetaTrader 5 that declares rules between the inputs of an Expert Advisor once in the code. OnInit rejects a combination that breaks a rule, with the reason in the Journal; before an optimization starts, OnTesterInit estimates which share of its passes the rules would reject and warns above a limit you set.
Prop Firm Equity Guard
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.
Accelerator Oscillator (AC)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.