EA-14733 · Breakout

OrderExample

A semi-automated Expert Advisor that places Buy/Sell orders via asynchronous OrderSendAsync() when the user clicks chart buttons. It calculates stop-loss and take-profit based on the highest and lowest prices over a 26-bar lookback period, and includes automatic lot sizing based on account risk percentage.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryBreakout
RiskMedium
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4, D1
IndicatorsHighest/Lowest (N-bar extremes)
AuthorCopyright 2009-2016, MetaQuotes Software Corp. ~ edited By 3rjfx : 2016/01/29

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

The EA's strategy concept is based on N-period high/low breakout trading, falling into the channel breakout category. Entry conditions are manual — the user clicks Buy or Sell buttons on the chart, so the EA does not auto-enter trades, making it semi-automated. Exit conditions rely on stop-loss and take-profit, where the SL is placed on the opposite side of the 26-period extreme plus a 2-spread offset, and TP is placed in the direction of the extreme plus a 2-spread offset; when SL or TP is within 20 points of current price, an additional minstop-point offset is applied. Position sizing is implemented via the TradeSize() function, which calculates lot size based on account balance and risk percentage, factoring in contract size and leverage. Money management uses the RiskPercentage parameter to control risk per trade, but the calculation divides the risked balance by contract value/leverage rather than computing risk based on stop-loss distance, which may result in actual risk deviating significantly from expectations. The overall strategy is straightforward but lacks any trend direction judgment, relying entirely on the user's decision.

Strengths

  • Uses OrderSendAsync() for non-blocking trade execution, suitable for high-frequency operation scenarios
  • Includes automatic lot sizing based on account balance and risk percentage for dynamic position adjustment
  • Has SL/TP protection with automatic offset when distances are insufficient, avoiding overly tight stops
  • Performs autotrading permission and account trading permission checks to prevent running in restricted environments
  • Uses OnTrade() event handler to track trading state changes, useful for debugging and monitoring

Weaknesses

  • Flawed money management calculation: uses balance/contract value instead of risk-based sizing on stop-loss distance, making actual per-trade risk uncontrollable
  • iHighest/iLowest functions have array out-of-bounds risk; loop iterates from depth to startPos without validating depth against array size
  • Lacks position check and duplicate order protection; users may click buttons multiple times causing repeated position openings
  • SL/TP logic in BuyAsync calculates TP based on highest price but the directional logic may be incorrect for buy orders, lacking clarity
  • Uses OrderSendAsync() but only checks if the function call succeeded, not whether the retcode indicates actual trade success
  • Hardcoded parameters (xhilo=26, minstop=28) are not exposed as configurable input variables, limiting flexibility

Possible improvements

  • Improve money management algorithm: calculate lot size based on stop-loss distance and risk percentage to ensure maximum loss per trade is controllable
  • Expose hardcoded parameters (xhilo, minstop, 20-point minimum distance threshold, etc.) as configurable input variables
  • Add position checking and duplicate order submission protection to prevent repeated openings from multiple button clicks
  • Add detailed retcode checking and trade result callback handling after OrderSendAsync() calls to ensure async order status is trackable

Risk assessment

Overall risk: Medium

  • Money management calculation is not based on stop-loss distance, so actual risk may far exceed expectations
  • Lacks position check and duplicate order protection, potentially leading to unintended multiple position openings
  • iHighest/iLowest functions have array out-of-bounds risk, which could return wrong indices causing abnormal SL/TP calculations
  • Async order submission lacks trade result confirmation mechanism; orders may fail without user awareness

Evaluation scores

Code quality2.0
Strategy logic2.0
Risk management2.0
Robustness2.0
Innovation1.0
Documentation2.0
Overall1.8

Parameters

ParameterDefaultDescription
MagicNumber1234567EA unique identifier number
RiskPercentage1.0Risk percentage per trade
TPvsSLRatio1.5Take profit to stop loss ratio
CalculatedTradeSizetrueAuto-calculate lot size
ManualyLotsSize"If Set CalculatedTradeSize = False, Input TradeLotSize Below"Manual lot size description text
TradeLotSize0.1Manually entered lot size

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.