Channel Breakout EA with ATR Trailing Stop and Risk Percentage Sizing

Channel Breakout EA with ATR Trailing Stop and Risk Percentage Sizing
Download ALL MT5 experts (1837)
YouTube Video Thumbnail



Similar MetaTrader Tools

Channel Breakout EA with ATR Trailing Stop and Risk Percentage Sizing

Info

The Channel Breakout EA with ATR Trailing Stop and Risk Percentage Sizing is a Expert Advisor for MetaTrader 5 that 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).

Usage

This tool is typically used for breakout trading when price moves beyond key support/resistance levels.

Platform

This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use Channel Breakout EA with ATR Trailing Stop and Risk Percentage Sizing

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

What this tool does

A simple, fully commented trend-following Expert Advisor for MetaTrader 5.

Typical Use Case

This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.

Description & Settings

Related: Noise Band Momentum: Intraday Nasdaq Breakout Strategy - another powerful expert for MetaTrader 5 traders.

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.

Also recommended: Opening Range Breakout EA for Gold (XAUUSD) - similar expert with strong performance on MetaTrader 5.


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

The initial stop-loss is k x ATR and is sent together with the order.

The lot size is calculated so that the loss at the stop equals the chosen percentage of the balance. The volume is rounded down to the volume step; if it is below the minimum lot, the trade is skipped.

The stop moves to break-even after the price closes +R in profit (R = the initial stop distance).

The ATR trailing stop follows the bar close and only moves in the trade's favour.

Inputs

- InpChannel (20) - channel length in bars
- InpUseEMA (true), InpEMA (200) - EMA trend filter on/off and its period
- InpATR (14) - ATR period
- InpStopATR (1.5) - initial stop in ATR
- InpTrailATR (3.0) - trailing stop in ATR, 0 = off
- InpBE_R (1.0) - move the stop to break-even after +R, 0 = off
- InpRiskPct (0.5) - risk per trade, % of balance
- InpMagic - magic number; InpLongs, InpShorts - allowed directions

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.

You may also like: H4 Breakout Retest EA for Gold (XAUUSD) - excellent alternative for expert users on MetaTrader 5.

Source Code

#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version   "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#include <Trade\Trade.mqh>
input int      InpChannel   = 20;
input bool     InpUseEMA    = true;
input int      InpEMA       = 200;
input int      InpATR       = 14;
input double   InpStopATR   = 1.5;

.......

Leave your opinion, ask a question, share some knowledge

⚠ Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.