Donchian Channel with Breakout Alerts

Donchian Channel with Breakout Alerts
Download ALL MT5 indicators (6068)
YouTube Video Thumbnail



Similar MetaTrader Tools

Donchian Channel with Breakout Alerts

Info

The Donchian Channel with Breakout Alerts is a Indicator for MetaTrader 5 that the donchian channel, developed by richard donchian, is a trend-following tool. Its upper band represents the highest high and its lower band represents the lowest low of the last N bars.

Usage

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

Platform

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

Setup

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


How to Install and Use Donchian Channel with Breakout Alerts

1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.

2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.

3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.

4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.

Frequently Asked Questions

Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."

Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).

Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.

What this tool does

The Donchian Channel, developed by Richard Donchian, is a trend-following tool.

Typical Use Case

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

Compatible Platform & Setup

This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.

Description & Settings

Related: Squeeze Momentum: Bollinger Bands Within Keltner Channel - another powerful indicator for MetaTrader 5 traders.

The Donchian Channel, developed by Richard Donchian, is a trend-following tool. Its upper band represents the highest high and its lower band represents the lowest low of the last N bars. The middle line is the average of these two bands.

Also recommended: Gold Donchian Breakout Channel (Non-Repainting with HTF Trend Filter) - similar indicator with strong performance on MetaTrader 5.


A price moving beyond the channel indicates a new N-bar high or low, forming the basis of the classic channel breakout approach.

The indicator compares each bar with the channel of the previous bar. A breakout occurs when a bar closes above the previous upper band or below the previous lower band. Arrows are drawn only on the first bar of a breakout, and an alert is sent once per bar.



Indicator Interpretation



Upper band (solid line) – The highest high over the last InpPeriod bars. Rising steps indicate new highs.

Lower band (solid line) – The lowest low over the last InpPeriod bars. Falling steps indicate new lows.

Middle line (dotted line, optional) – The average of the bands, serving as a dynamic equilibrium level or trailing reference.

Up arrow below the bar – Bullish breakout: the bar exceeded the previous upper band.

Down arrow above the bar – Bearish breakout: the bar fell below the previous lower band.

Channel width – A narrow channel signifies low volatility and a quiet market. A widening channel indicates rising volatility.

Info label (upper-left corner) – Displays the current upper and lower bands, channel width in points, and the current bar's status: Inside, Breakout UP, or Breakout DOWN.

Alerts – Generated upon appearance of a new breakout signal, including symbol, timeframe, direction, and price.

Fig. 1. Donchian Channel (20) on an H1 chart with middle line and breakout arrows.



External Variables (Inputs)

Input
Default
Purpose

InpPeriod
20
Number of bars for highest high and lowest low (2 or more).

InpShowMiddle
true
Displays the middle channel line.

InpBreakoutBy
DON_BREAKOUT_CLOSE
Breakout condition: close beyond the previous channel (DON_BREAKOUT_CLOSE) or high/low exceeding it (DON_BREAKOUT_EXTREME).

InpShowArrows
true
Draws breakout arrows on the chart (alerts function independently).

InpAlertPopup
true
Shows an alert window.

InpAlertPush
false
Sends a push notification to the mobile terminal.

InpAlertEmail
false
Sends an e-mail.

InpAlertOnBarClose
true
true: alert based on the last closed bar. false: alert sent as soon as the forming bar meets the condition.

InpShowInfoLabel
true
Shows the label with channel values, width, and status.

InpLabelColor
clrSilver
Color of the info label.

Colors and line styles for bands and arrows can be adjusted in the indicator properties' "Colors" tab.



Recommended Use

Symbols and timeframes: Suitable for any symbol and timeframe. Breakout methods are effective on trending instruments and more reliable on M30–D1 timeframes. Sideways markets may produce frequent false breakouts. Longer periods yield fewer, stronger signals; shorter periods provide earlier but noisier signals.

Close or extreme: The close-based condition filters out spikes and is the recommended default. The high/low condition reacts earlier but generates more false signals. If a bar breaks the channel on both sides, the candle's direction determines the breakout direction.

Alerts: With InpAlertOnBarClose = true, the signal is persistent but appears one bar later. With false, alerts are faster, but a breakout on a forming bar might not hold until the close. Alerts are sent once per bar and direction. No alerts are provided for historical data upon indicator initialization. Configure push notifications or e-mail in terminal settings beforehand.

Caveats: The channel is a lagging tool, and breakouts do not guarantee trends. Spreads, gaps, and news events can influence signals. Use arrows as supplementary information alongside your own entry rules and risk management.

Calculation: After initial calculation, only the forming bar and new bars are recalculated. The highest high and lowest low are determined within a window of InpPeriod bars.

Account types: This indicator does not perform trades and functions identically on netting and hedging accounts.

The info label is created with a unique prefix and removed upon indicator deletion or reinitialization.

You may also like: Donchian Breakout Channel with ATR Trailing Stop - excellent alternative for indicator 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"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_plots   5
#property indicator_label1  "Upper"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrDodgerBlue

.......

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.