Risk Management EA Based on ATR Volatility
This EA uses ATR (Average True Range) volatility to dynamically calculate position sizing and stop loss levels, adapting risk exposure to current market conditions. It enters trades when price action confirms a trend direction relative to ATR-based thresholds and manages exits through ATR-adjusted trailing stops. The core philosophy is that volatile markets require wider stops and smaller positions, while calm markets allow tighter stops and larger positions.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core strategy of this EA is an adaptive risk management trend-following system based on ATR volatility. Entry conditions typically rely on price breaking through an ATR-multiple-defined volatility channel, going long when price breaks above the upper band and short when breaking below the lower band, capturing trend initiation points. Exit conditions use ATR multiples for both stop loss and take profit, with stop distance automatically adjusting to market volatility to avoid being stopped out by noise during increased volatility. Position sizing is the key focus of this EA, dynamically determining lot size by dividing the account risk percentage by the per-point value calculated from ATR, ensuring a fixed monetary risk per trade. In terms of money management, the EA automatically calculates optimal position size based on account balance and the set risk percentage, implementing fixed-fractional money management. The overall strategy performs well in trending markets but may generate numerous false breakout signals in ranging conditions, leading to consecutive losses.
Strengths
- ATR-based adaptive position sizing dynamically adjusts risk exposure according to market volatility, providing a scientifically sound approach
- Stop loss distance automatically adjusts with volatility, preventing premature stop-outs from noise during increased volatility periods
- Fixed-fractional money management ensures controllable risk per trade, preventing significant account drawdowns from single losses
- Trailing stop mechanism allows winning positions to ride trends, maximizing trend profit capture
- Parameterized design offers flexibility for traders to adjust ATR period and multipliers for different instruments and market conditions
Weaknesses
- Trend-following strategy prone to consecutive false breakout signals in ranging markets, leading to frequent stop-outs
- ATR indicator has inherent lag and may fail to reflect true risk in real-time during sudden volatility spikes
- Lacks multi-timeframe confirmation, relying on single-timeframe ATR signals which may produce misjudgments
- No explicit trading session filter, potentially generating unfavorable fills during low-liquidity periods
- Over-reliance on a single indicator (ATR), lacking comprehensive judgment combining price action and trend strength
Possible improvements
- Add multi-timeframe ATR confirmation and trend direction filtering, such as using daily ATR to determine macro trend before entering on hourly chart
- Implement volatility regime detection to automatically reduce position size or pause trading during low-volatility ranging periods, minimizing false breakout losses
- Add trading session filter to avoid low-liquidity periods and major news release times
Risk assessment
Overall risk: Low
- ATR lag may result in insufficiently wide stops, still exposing to slippage losses during sudden events
- Trend following in sideways markets generates consecutive small losses, requiring sufficient capital to endure drawdown periods
- Lacks maximum drawdown limit and daily loss cap, potentially exceeding expected risk in extreme scenarios
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
ATR_Period | 14 | ATRcalculation period |
ATR_Multiplier_SL | 2.0 | ATR stop loss multiplier |
ATR_Multiplier_TP | 3.0 | ATRtake profit multiplier |
Risk_Percent | 1.0 | Risk percentage per trade |
ATR_Timeframe | H4 | ATRindicatortime period |
Trailing_Stop_ATR_Multi | 1.5 | trailing stopATR multiplier |
Max_Spread | 30 | Maximum allowed spread |
Magic_Number | 59001 | EA magic number |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.