Donchian Trend EA

Donchian Trend EA:

The Ultimate Macro Breakout Bot

Catch the big moves. Ride the macro trends. Let the math manage the risk.

 

Introducing Donchian Trend EA, a robust, fully automated Expert Advisor that brings the legendary Donchian Channel breakout strategy into the modern algorithmic era. Designed for higher timeframes, this bot is built to capture massive, sustained market trends while strictly protecting your capital from choppy, ranging markets.

 

By combining classic price-action breakouts with a 200 EMA trend filter, dynamic ATR-based stops, and an intelligent dual-trailing exit system, this bot ensures you are always trading in the direction of the dominant momentum.

 

 


 

 

The Core Strategy: How It Works

The Donchian Trend EA operates on a "closed bar only" evaluation system, ensuring it ignores intraday noise and focuses purely on confirmed structural breakouts.

 

  1. The Donchian Breakout: The bot calculates the highest high and lowest low over a configurable lookback period (default: 55 bars). A buy signal is generated when the price closes above the 55-period high, and a sell signal triggers when it closes below the 55-period low.
  2. The 200 EMA Trend Filter: To prevent false breakouts in ranging markets, the bot applies a 200-period Exponential Moving Average. It will only execute buy breakouts if the price is above the 200 EMA, and sell breakouts if the price is below it.
  3. One Trade at a Time: The bot maintains strict focus, allowing only one active position per account to ensure precise risk management and clear trade tracking.

 

 


 

 

Advanced Trade Management & Dynamic Exits

Knowing when to exit is just as important as knowing when to enter. Donchian Trend EA features a sophisticated, multi-layered exit strategy designed to let winners run while cutting losers quickly:

 

  • ATR-Based Initial Stop: The initial stop loss is placed dynamically based on the Average True Range (default: 2.5x ATR), giving the trade enough room to breathe without risking excessive capital.
  • Dual Trailing Exit System: Once in profit, the bot trails the stop loss using two methods simultaneously:
    1. Donchian Exit Channel: Trails the stop behind the lowest low of the last 20 bars (for buys) or highest high (for sells).
    2. ATR Trailing Stop: Trails the stop at a fixed distance of 3.0x ATR from the current price.
  • Automatic Reversal Logic: If the bot is in a buy position and a valid sell breakout occurs, it will automatically close the losing trade and instantly reverse into a new sell position, ensuring you are always aligned with the new trend.

 

 


 

 

Institutional Risk Control

Capital preservation is hardcoded into the bot's logic:

 

  • Dynamic Position Sizing: Risks a strict percentage of your account balance per trade (default: 1.0%). The lot size is automatically calculated based on the exact distance to the ATR stop loss.
  • Max Drawdown Circuit Breaker: If the account equity drops by a specified percentage from its peak (default: 30%), the bot will immediately halt all new trade entries until the account is reset or manually restarted.
  • Spread Protection: Includes a configurable maximum spread filter to prevent entries during illiquid hours or sudden broker spread widening.

Disclaimer

Trading foreign exchange and commodities (especially Gold/XAUUSD) on margin carries a high level of risk and may not be suitable for all investors. Past performance of the EA or backtested results does not guarantee future results. The high degree of leverage can work against you as well as for you. Before deciding to trade, you should carefully consider your investment objectives, level of experience, and risk appetite. There is a possibility that you may sustain a loss of some or all of your initial investment.

Frequently asked questions

Q: What is the core trading strategy of this bot? A: The bot uses a classic Donchian Channel breakout strategy combined with a 200-period Exponential Moving Average trend filter. It is designed to catch and ride macro trends on higher timeframes.

 

Q: How does the bot determine when to enter a trade? A: It evaluates the market only on closed bars. It calculates the highest high and lowest low over a 55-bar lookback period. It enters a buy trade when the bar closes above the 55-bar high (and above the 200 EMA), and a sell trade when it closes below the 55-bar low (and below the 200 EMA).

 

Q: How does the bot manage stop losses and take profits? A: It does not use a fixed take profit. Instead, it uses a dynamic initial stop loss based on the Average True Range (default 2.5x ATR). Once in profit, it trails the stop loss using a dual system: a 20-period Donchian exit channel and an ATR-based trailing stop (default 3.0x ATR).

 

Q: What happens if the trend suddenly reverses? A: The bot features automatic reversal logic. If it is holding a buy position and a valid sell breakout signal occurs, it will immediately close the buy position and open a new sell position to align with the new trend.

 

Q: Does this bot use Martingale, Grid, or Hedging? A: Absolutely not. This is a strict directional trend-following bot. It holds only one position at a time, uses a hard stop loss on every trade, and risks a fixed percentage of the account balance per trade.

 

Q: How does the bot protect the account from massive drawdowns? A: It includes a built-in Max Drawdown Circuit Breaker. If the account equity drops by a configurable percentage from its peak (default is 30%), the bot will automatically stop opening new trades to protect the remaining capital.

 

Q: What timeframes is this bot designed for? A: The bot evaluates signals only on closed bars to avoid intraday noise. It is specifically optimized for higher timeframes, such as the 4-Hour (H4) or Daily (D1) charts, where macro breakouts are most reliable.

 

Q: Is there a filter for high spreads? A: Yes. The bot includes a maximum spread filter. If the current spread exceeds the configured limit (measured in points), the bot will reject the entry signal to prevent slippage and poor execution during illiquid market hours.

Results

Click on  the pictures to enlarge.

Version - 3929

Version - 4353

Version - 16430

Version curated

Version 5984

Version - 5871

Version 5883

Add comment

Comments

There are no comments yet.

Create Your Own Website With Webador