Turtles 3xATR EA: A Trend-Following Expert Advisor for MetaTrader 5
Overview
Turtles 3xATR EA is an automated trading robot inspired by the classic Turtle Trading system. It focuses on capturing breakouts in trending markets while using volatility-based stops to manage risk. The EA trades one position at a time per symbol, entering on breakout signals and trailing stops to lock in profits. It emphasizes disciplined risk control, never risking more than a configurable percentage of your account per trade.The expert has implemented a robust reduction position size which is activated once the account balance decreases more than 10% by default. When the loss in the account balance is recovered the position size automatically is restored to the initial value (1% risk per trade from the account balance by default). It can be used to trade forex, crypto, metals, stocks, commodities.
Key Inputs (Customizable)
- EntryPeriod: 20 (bars) – Period for detecting breakouts.
- StopLossATRPeriod/TrailATRPeriod: 20 (bars) – ATR calculation period for stops.
- StopLossATRMultiplier/TrailATRMultiplier: 3.0 – Multiplier for initial and trailing stops (wider than original Turtles for less whipsaw).
- InitialRiskPercent: 1.0% – Max account risk per trade.
- Other options: Enable drawdown-based risk reduction, magic number for trade identification, etc.
How It Works: Step-by-Step
1. Detecting New Bars and Levels
- The EA runs on every tick but only updates signals on new bar closes (e.g., end of D1 candle).
- It calculates:
- Entry High/Low: Highest high and lowest low over the past 20 bars (excluding current).
- ATR (Average True Range): Volatility measure over 20 bars, using Wilder's smoothing (RMA).
2. Entry Signals (Breakout Trading)
- Long (Buy): If the current Ask price breaks above the 20-bar high, open a buy position.
- Short (Sell): If the current Bid price breaks below the 20-bar low, open a sell position.
- Only one position open at a time—no pyramiding or multiple entries.
- Position size is auto-calculated to risk exactly 1.0% (or your setting) of account balance, based on the stop distance.
3. Initial Stop Loss
- Set immediately on entry:
- Long: Entry price minus (3 × ATR).
- Short: Entry price plus (3 × ATR).
- This gives the trade "breathing room" in volatile conditions, avoiding early exits.
4. Trailing Stop (Profit Locking)
- Updated only on new bar closes, using the previous bar's close as reference.
- Tracks a "Reference Extreme" (highest close for longs, lowest for shorts) that ratchets in the trade's favor.
- For Longs:
- Reference High = max(Previous Reference High, Previous Close).
- New Trail Stop = Reference High minus (3 × ATR).
- Move the stop up if the new level is higher than current (locks profits); never lower.
- Bonus: If volatility (ATR) drops even without new highs, the trail tightens to protect more gains.
- For Shorts: Mirror logic—Reference Low = min(Previous Reference Low, Previous Close); Trail Stop = Reference Low plus (3 × ATR). Move down if beneficial.
- Exits automatically if price hits the trail stop (via broker SL modification).
5. Exits
- Primary: Hit initial or trailing stop loss.
- No take-profit—lets winners run indefinitely in trends.
- (Note: Classic 10-bar reversal exits removed for this variant.)
6. Risk Management Features
- Position Sizing: Scales lots dynamically so stop distance risks a fixed % (e.g., 1.0%) of balance.
- Drawdown Protection: If enabled, reduces risk % after drawdowns (e.g., cuts by 20% per 10% loss threshold, up to 3 steps). Resets on new balance highs.
- Persistence: Saves risk state to file across restarts/reboots to avoid resets.
- Logs critical events (e.g., entries, trails) for monitoring.
Performance Notes
- Best in trending markets; may underperform in sideways chop (like original Turtles).
- Backtest on your broker's data—expect 20-40% drawdowns in tests, but strong long-term equity curves.
- Run on any timeframe (e.g., H1/D1), but as a trend follower i recommend using daily timeframe.
This EA keeps things simple: Break in, ride the trend, trail smartly, and cut losses quick.