donchian channel
Info
The donchian channel is a Indicator for MetaTrader 4 that donchian channel the donchian channel is an indicator used in market trading developed by richard donchian it is formed by taking the highest high and the lowest low of the last n periods. the area between the high and the low is the channel for the period chosen.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Indicators folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use donchian channel
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
donchian channel the donchian channel is an indicator used in market trading developed by richard donchian it is formed by taking the highest high and the lowest low of the last n periods.
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Indicator works on MetaTrader 4. Place the file in the MQL4/Indicators folder and restart the terminal.
Description & Settings
Related: donchian channel indicator - another powerful indicator for MetaTrader 4 traders.
donchian channelthe donchian channel is an indicator used in market trading developed by richard donchian it is formed by taking the highest high and the lowest low of the last n periods. the area between the high and the low is the channel for the period chosen.
Also recommended: all channel indicator - similar indicator with strong performance on MetaTrader 4.
a line is marked for the high and low values visually demonstrating the channel on the markets price. this indicator also includes a mid line and a moving average of the mid line.the donchian channel is a useful indicator for seeing the volatility of a market price. if a price is stable the donchian channel will be relatively narrow. if the price fluctuates a lot the donchian channel will be wider. its primary use, however, is for providing signals for long and short positions.
if a security trades above its highest n periods high, then a long is established. if it trades below its lowest n periods low, then a short is established.
buffers used in indicator
this indicator uses four buffers representing;
upper donchian channel - buffer 0 - green line
middle donchian channel - buffer 1 - blue line
lower donchian channel - buffer 2 - green line
ma donchian channel - buffer 3 - red line
the code
the code is fairly straightforward, it gets the high and low for the last ānā periods in inpbarstolookback. it then takes an average of the high and low values to create the middle line of the channel. the imaonarray function is then used to get a moving average of the middle donchian channel based upon parameters inpmaperiod and inpmamethod that have been inputted.
chart output
the output on the chart consists of the four buffers outlined above. if needed the color can be changed to none to show only buffers that are needed.
icustom
to call the indicator using the icustom function;
double donchian = icustom(symbol(), period(), "donchian channel", inpbarstolookback, inpmaperiod, inpmamethod, buffer[], shift);
to use a script to call the last price of the moving average buffer using the default parameters it would be;
double donchian = icustom(symbol(), period(), "donchian channel", 20, 14, mode_sma, 3, 0);
thanks
thank you for taking the time to download this indicator. please feel free to post any questions related to the indicator and reviews are appreciated.
You may also like: commodity channel index (cci) - excellent alternative for indicator users on MetaTrader 4.
Source Code
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.00"
#property strict
#property description "Educational code - RobotFX www.robotfx.org"
#property description "Educational code - RobotFX www.robotfx.org"
#property description "Educational code - RobotFX www.robotfx.org"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 clrGreen
.......
⚠ 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.