AI Donchian Breakout Trader
- Uzmanlar
- Sürüm: 1.0
Overview
AI Donchian Breakout Trader is a fully automated Expert Advisor for MetaTrader 5. It tracks a rolling price channel (the highest high and lowest low over a configurable lookback) and looks for a genuine breakout beyond that channel, scored by an AI-inspired confidence engine before any trade is considered.
How It Works
- The EA continuously calculates a price channel from recent highs and lows, excluding the forming and just-closed bars from the channel calculation itself.
- A breakout signal appears when the most recently closed bar's price closes beyond the upper or lower edge of that channel.
- Breakout strength is measured as the distance beyond the channel edge, normalized against current ATR volatility.
- Each breakout is cross-checked against the ADX indicator's main line to confirm the move has underlying trend strength before it is treated as a signal.
- An optional EMA trend filter can require the breakout direction to agree with the longer-term trend.
- A 0-100 AI-inspired confidence score combines breakout strength and trend strength. A trade is only considered once the score clears a configurable minimum threshold.
Risk Management
- ATR-based stop loss and take profit distances that adapt to current market volatility.
- Optional ATR-based trailing stop. Before adjusting the stop loss, the EA checks the distance between price and the current take profit to avoid broker rejections when price is already close to the target.
- A margin check runs before every trade request, comparing the estimated required margin against free margin with a safety buffer.
- Lot size is automatically normalized to the broker's minimum, maximum and step volume constraints.
- A configurable session-time filter with an edge buffer, plus a maximum spread filter, help the EA stand aside in unfavorable conditions.
- One position at a time per symbol/magic number.
Input Parameters
- InpMagicNumber - unique identifier for this EA's trades.
- InpTimeframe - working timeframe used to build the price channel and indicators.
- InpMaxSpreadPoints - maximum allowed spread, in points, before a new trade is skipped.
- InpEdgeBufferSeconds - buffer, in seconds, kept clear from the session open/close edges.
- InpDonchianPeriod - number of bars used to compute the price channel (highest high / lowest low).
- InpAtrNormMult - ATR multiple that maps to the maximum breakout-strength confidence score.
- InpAdxPeriod - period used for the ADX calculation.
- InpAdxNorm - ADX value that maps to the maximum trend-strength confidence score.
- InpMinConfidence - minimum AI confidence score (0-100) required before a trade is opened.
- InpUseEmaFilter, InpEmaTrendPeriod - optional longer-term trend sanity filter.
- InpLotSize - base lot size before broker volume normalization.
- InpAtrPeriod, InpSlAtrMult, InpTpAtrMult - ATR period and multipliers used to size the stop loss and take profit.
- InpMinStopPoints - minimum stop distance in points, regardless of ATR.
- InpUseTrailing, InpTrailAtrMult, InpTrailStepPoints - trailing stop settings.
Important Notes
This Expert Advisor automates a clearly defined trading logic based on price-channel breakout detection and trend-strength confirmation. It does not guarantee profit, and no result - hypothetical or otherwise - is a reliable indicator of future performance. Please test on a demo account first, use position sizing appropriate to your account, and be aware that trading leveraged instruments carries a risk of loss.
