RangeBreakout2
A periodic range breakout EA that sets up price boundaries (High/Low) based on ATR, percentage, or fixed range at scheduled times (weekly or daily), then opens breakout trades when price crosses those boundaries. It supports multiple trade modes (stop/limit/random), lot management strategies (constant/linear/martingale/fibonacci), and configurable take-profit/stop-loss percentages. The EA cycles through StandBy, Setup, Trade, and Deal phases, resetting after each completed deal.
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: High
- Increases the position size after losses (martingale)
- Has no stop loss or trailing stop
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 strategy concept is to establish a price range at scheduled times (weekly on a specified day or daily at a specified hour), then enter trades when price breaks out of the range boundaries. Entry conditions: when Ask breaks above the upper boundary, direction depends on trade mode — Stop mode goes long, Limit mode goes short; conversely when Bid breaks below the lower boundary. Exit conditions rely on configurable take-profit and stop-loss percentages, both calculated as proportions of the range. Position sizing supports four modes: constant lot size, linear increment (lot increases linearly after losses), martingale (lot doubles after losses with configurable multiplier), and Fibonacci (lot follows Fibonacci sequence after consecutive losses). Money management controls base lot size via a margin percentage and uses OrderCalcMargin to verify sufficient funds before opening positions. Range can be calculated via ATR indicator, price percentage, or fixed points, with a range multiplier to widen the range after losses.
Strengths
- Multiple range calculation modes (ATR/Percent/Fixed) adapt to different market volatility environments
- Clean four-phase state machine design (StandBy/Setup/Trade/Deal) with clear logic flow
- Supports multiple lot management strategies, allowing users to choose based on risk preference
- Well-organized input parameters with range validation to prevent misconfiguration
- Visual aids (horizontal/vertical lines) help users understand the current range setup
Weaknesses
- Default martingale lot management exponentially increases position size after consecutive losses, creating account blowup risk
- Trade phase is empty — no handling of open positions mid-trade (e.g., trailing stop, partial close)
- Random trade mode lacks strategic purpose, and the switch statement is missing break clauses causing fall-through
- No check for existing open positions, potentially allowing duplicate entries and uncontrolled risk exposure
- Hour conversion logic in SetupCondition has potential issues — forcing hour=0 when >=23 may skip the correct time window
Possible improvements
- Add position check logic to prevent duplicate entries when an existing position in the same direction is already open
- Fix the missing break clauses in CheckRandom() switch statement, and consider removing Random mode or giving it meaningful strategy logic
- Implement trailing stop or breakeven logic in the Trade phase to improve risk management for open positions
Risk assessment
Overall risk: High risk
- Martingale lot management causes exponential position growth on consecutive losses, potentially blowing up the account
- No position check mechanism may allow duplicate entries within the same range, causing uncontrolled risk exposure
- Missing break in CheckRandom() switch causes fall-through, potentially producing unexpected trade direction
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Periodicity | Weekly | Periodicity mode: weekly, daily, or continuous |
Day | Monday | Trading day for weekly mode |
Hour | H0 | Setting time for daily/weekly mode |
RangeMode | ATR | Range calculation mode: ATR, percentage, or fixed |
perATR | 50 | ATR percentage (10-500 in ATR mode) |
perPrice | 1 | Price percentage (0.1-10 in percentage mode) |
rangeFixed | 1000 | Fixed range in points (10-5000 in fixed mode) |
TradeMode | Stop | Trade mode: stop breakout, limit reversal, or random |
perRange | 100 | Range percentage (10-100), defines band distance from center |
perProfit | 100 | Take-profit percentage (10-100), based on range width |
perLoss | 100 | Stop-loss percentage (10-100), based on range width |
lotMode | Martingale | Lot management mode: fixed, linear, Martingale, Fibonacci |
perMargin | 10 | Margin percentage (0.1-20) |
lotMultiplier | 2 | Martingale lot multiplier (1-2) |
rangeMultiplier | 1 | Range multiplier after loss (1=disabled, 1-2) |
Similar Breakout EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.