Exp_DarvasBoxes_System
This EA implements the Darvas Boxes trading system, which identifies box-shaped trading ranges and trades breakouts from those ranges. It uses the custom DarvasBoxes_System indicator to detect upward and downward breakout signals, then opens buy or sell positions accordingly. The system includes configurable money management, stop loss/take profit, and separate controls for opening and closing positions on both sides.
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 | +4.27% | +3.70% | 4.40% | 15 | 42.90% | 0.76 | 0.97 | 3 | +$25.62 | Reliable |
| GBPUSD | -2.25% | -1.96% | 8.15% | 23 | 31.80% | -0.26 | -0.28 | 6 | −$9.55 | Reliable |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | No trades |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | No trades |
Profitable on 1 of 2 markets with reliable results.
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.
Against the other Breakout EAs with a reliable result on the same market: EURUSD: better than 89% of 18 · GBPUSD: better than 22% of 18
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +2.81% 2026-09 | -1.94% 2026-04 |
| GBPUSD | 31% | +3.77% 2026-02 | -2.84% 2026-01 |
From the backtest equity curve, sampled about every two days; only reliable results.
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
This EA is based on the Darvas Box theory, a classic breakout trading strategy proposed by Nicolas Darvas. The strategy identifies box-shaped trading ranges through the DarvasBoxes_System custom indicator and trades breakouts from those ranges. When price breaks above the box top, a buy signal is generated (Col[1]>2 and Col[0]<3), and when price breaks below the box bottom, a sell signal is generated (Col[1]<2 and Col[0]>1). Entry conditions rely entirely on the indicator's buffer values, where buffer index 6 provides signal data with Col[1] determining breakout direction and Col[0] confirming breakout strength. For exits, the EA uses fixed stop loss and take profit levels (default 1000 and 2000 points respectively), and also actively closes positions when opposing breakout signals appear. Position sizing supports multiple modes through the MM parameter and MMMode enumeration, including percentage of free margin, balance, margin after deducting losses, and fixed lot size. The EA implements a new bar detection mechanism to avoid duplicate signals and allows users to select the signal trigger bar via the SignalBar parameter.
Strengths
- The Darvas Box is a classic and well-validated breakout strategy with clear and reliable logic
- Multiple money management modes provide flexibility to suit different risk preferences
- Independent control of buy/sell opening and closing enables fine-grained strategy management
- New bar detection mechanism prevents duplicate position openings on the same bar
- Using completed bars (SignalBar=1) as signal source reduces false signals
Weaknesses
- Complete dependency on the custom DarvasBoxes_System indicator whose algorithm is opaque and not auditable
- Fixed stop loss and take profit in points without considering market volatility (e.g. ATR), which may be unsuitable across different market conditions
- Lacks position scaling logic (add/reduce), making position management relatively simplistic
- No spread filter or trading session filter, potentially leading to unfavorable fills during high spread or low liquidity periods
- Signal judgment uses hardcoded numeric thresholds (2 and 3), lacking adaptability to changing market conditions
Possible improvements
- Add ATR-based dynamic stop loss and take profit to adapt risk management to changing market volatility
- Add spread filter and trading session filter to avoid entries during unfavorable trading conditions
Risk assessment
Overall risk: Medium
- Dependency on a custom indicator with unauditable logic means signal reliability cannot be independently verified
- Fixed stop loss/take profit without volatility consideration may result in frequent stop-outs during high volatility periods
- Lack of spread filter may cause significant slippage during low liquidity periods
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MM | 0.1 | Money management ratio or lot size, depends on MMMode setting |
MMMode | LOT | Position sizing: free margin/balance/post-loss balance ratio or fixed lots |
StopLoss_ | 1000 | Stop loss in points |
TakeProfit_ | 2000 | Take profit in points |
Deviation_ | 10 | Maximum allowed slippage |
BuyPosOpen | true | Allow buy to open |
SellPosOpen | true | Allow sell to open |
BuyPosClose | true | Allow buy to close |
SellPosClose | true | Allow sell to close |
InpInd_Timeframe | PERIOD_H4 | DarvasBoxes_System indicator timeframe |
symmetry | true | Box symmetry parameter |
Shift | 2 | Indicator offset |
SignalBar | 1 | Signal bar index, 0=current bar, 1=completed bar |
Similar Breakout EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.