EA-1598 · Breakout

NarrowestRangeSignal EA

This EA places bracket stop orders (buy stop above and sell stop below) when the NarrowestRangeSignal indicator identifies a narrow price range. When one side triggers, the opposite pending order is deleted, implementing an OCO (One-Cancels-Other) breakout strategy from narrow range consolidation.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryBreakout
RiskMedium
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsNarrowestRangeSignal (Custom)
AuthorRone.

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD0.00%0.00%0.00%0—————Not convertible yet
GBPUSD0.00%0.00%0.00%0—————Not convertible yet
USDJPY0.00%0.00%0.00%0—————Not convertible yet
XAUUSD0.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 strategy concept is based on narrow range breakout, where the NarrowestRangeSignal indicator detects the narrowest bar range within a specified period to generate a signal. Entry conditions involve placing a buy stop order above the range high plus an indent offset and a sell stop order below the range low minus an indent offset when the indicator fires, creating bracket stop orders on both sides. Exit conditions rely on a fixed take profit parameter for closing positions, with stop loss set on the opposite side of the range (buy stop SL below the low, sell stop SL above the high). Position sizing supports two modes: fixed lot and fixed percentage, where the percentage mode calculates lot size based on available free margin and account leverage. Money management includes lot validation against broker min/max limits and step normalization via CheckLotValue, but lacks independent risk control for stop loss sizing, and there is no trailing stop or break-even mechanism.

Strengths

  • Clear and logical narrow range breakout strategy that captures momentum after low-volatility consolidation periods
  • Reasonable OCO bracket order mechanism that automatically deletes the opposite pending order when one side triggers, avoiding dual-position risk
  • Supports both fixed lot and fixed percentage position sizing modes, offering good flexibility

Weaknesses

  • Lacks trailing stop and break-even mechanisms, so winning positions may give back significant profits before being stopped out
  • Stop loss is placed at the opposite side of the range minus indent, which may result in stops that are too tight or too wide without dynamic ATR-based adjustment
  • DeletePendingOrders uses a static variable for new bar checking that duplicates and potentially conflicts with CheckOrders logic, and creating a new CTrade object each tick is inefficient

Possible improvements

  • Add ATR-based dynamic stop loss and trailing stop mechanisms to replace fixed indent and fixed take profit, making the strategy adaptive to different market volatility conditions
  • Optimize code structure by declaring CTrade as a global variable to avoid repeated instantiation, and unify the new bar checking logic to prevent static variable conflicts between functions

Risk assessment

Overall risk: Medium

  • Stop loss calculation is not robust enough; subtracting indent from the opposite range side may result in stops too tight and easily triggered by false breakouts
  • No maximum position count limit or daily maximum loss control, so consecutive signals may cause frequent trading and capital loss
  • Static prev_time variables in both DeletePendingOrders and CheckOrders may cause new bar detection to be out of sync, presenting a logic flaw

Evaluation scores

Code quality3.0
Strategy logic3.0
Risk management2.0
Robustness3.0
Innovation2.0
Documentation2.0
Overall2.5

Parameters

ParameterDefaultDescription
InpBarsInRange3Number of bars within narrow range
InpCheckPeriod10Period to check for narrowest range
InpIndent50Offset in points from high/low for pending orders
InpTakeProfit500Take profit in points
InpMmModeFIXED_LOTMoney management mode: fixed lot or fixed percentage
InpVolume1.0Trading volume (lots or percentage)

Similar Breakout EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.