How to Spec Out a Custom MT4 EA

A complete guide to writing a requirements specification that gets you a working, profitable Expert Advisor — not a buggy mess that needs six rewrites.

May 24, 2026 MT4 Development, MQL4, Expert Advisors

Why a Good Spec Matters

Every custom MT4 EA development project starts with a conversation. The difference between a project that ships in two weeks and one that drags on for months is the quality of the specification.

A well-written spec eliminates ambiguity, sets clear expectations, and gives the developer a blueprint they can execute against. Vague instructions like "buy when RSI is low" produce vague results.

Below is the exact framework we use at AlgoSpecial to spec every custom EA. Use it as a template for your next project.

1. Strategy Overview

Start with a one-paragraph summary so the developer understands the big picture before diving into details.

"This EA trades EURUSD on the H1 timeframe using a trend-following strategy. Entry is triggered when the 50 EMA crosses above the 200 EMA and RSI(14) is above 50. Stop loss is 30 pips. Take profit is 90 pips. Maximum 2 trades per day."

Include: trading style (trend, mean reversion, breakout, grid, scalping), timeframe(s), symbols, and the core edge.

2. Entry Logic (Signal Engine)

Be precise about conditions. Use "AND" and "OR" explicitly. Avoid ambiguous language.

Long Entry Conditions

  • 50 EMA crosses ABOVE 200 EMA (on the current bar)
  • RSI(14) > 50 (on the previous closed bar — prevent repaint)
  • [Optional] No trade was opened in the last 4 hours
  • [Optional] Current spread < 20 points

Short Entry Conditions

  • 50 EMA crosses BELOW 200 EMA
  • RSI(14) < 50
  • Same optional filters as long entry

Key: Specify whether conditions fire on bar open, bar close, or every tick. Specify which bar's data each indicator uses (e.g., "previous closed bar" to avoid repaint).

3. Exit Logic

Every position needs a clear exit rule. Multiple exit rules should be prioritised.

  • Stop Loss: Fixed pips (e.g., 30 SL) or dynamic (ATR-based: 1.5x ATR(14))
  • Take Profit: Fixed pips, risk-reward ratio (e.g., 1:3), or structure-based (previous swing high/low)
  • Trailing Stop: How many pips behind price? Activate after how many pips in profit? Update frequency (every tick, every N pips, every new bar)?
  • Time-based Exit: Close all positions at end of day? Before London close? Friday afternoon?
  • Reverse Signal Exit: Close long when short signal fires (and vice versa)?

4. Money Management & Risk

The difference between a toy EA and a production-grade system is almost always the risk engine. Read our MT4 development guide for the technical implementation.

Parameter Example
Position sizing method Fixed lot (0.10), fractional risk (2% per trade), ATR-based
Max simultaneous positions 3 total, 1 per symbol
Daily loss limit Stop trading for the day if -$200 or -5% equity
Max drawdown cut-off Close all trades and stop EA if equity drops 20% below peak
Max trades per day 5 total (long + short)

5. Filters & Guards

Filters prevent the EA from trading in unsuitable market conditions.

Time Filters

  • Trading hours (e.g., 08:00 - 17:00 GMT)
  • Avoid specific days (e.g., no trading on Friday after 12:00 GMT)
  • News filter (NFP, FOMC, CPI — block 1 hour before and after)

Market Condition Filters

  • Minimum spread (e.g., block trade if spread > 25 points)
  • Volatility filter (e.g., ATR > N pips)
  • Trend filter (e.g., only trade in direction of higher timeframe trend)

6. Broker & Execution Settings

MT4 EAs must be tuned to the broker's execution environment.

  • Broker name: (execution type, ECN/STD, commission structure)
  • Magic number: unique identifier for this EA
  • Slippage tolerance: max slippage in points
  • Max spread: skip trade if spread exceeds X points
  • Order comment: string tag for trade identification
  • Lot rounding: lot step (0.01, 0.10) based on broker limits

7. Testing & Acceptance Criteria

Define what "done" looks like before development starts.

  • Backtest period: last 5 years of tick data
  • Minimum trades: 200+ for statistical validity
  • Profit factor target: > 1.5
  • Max drawdown limit: < 20%
  • Walk-forward test: optimise on 3 years, validate on 2 years
  • Demo test: 30 days minimum with real spread/commission modelling

Free EA Specification Template

Copy the checklist below and fill it out before contacting a developer. The more complete this is, the fewer revision rounds you'll need.

## EA Specification Template

**Strategy Summary:**
**Trading Style:** [Trend / Mean Reversion / Breakout / Grid / Scalping]
**Timeframe(s):** [M1 / M5 / M15 / M30 / H1 / H4 / D1]
**Symbol(s):** [EURUSD, GBPUSD, XAUUSD, etc.]

**Long Entry:**
  - Condition 1:
  - Condition 2:
  - Condition 3:

**Short Entry:**
  - Condition 1:
  - Condition 2:
  - Condition 3:

**Stop Loss:** [Fixed X pips / ATR-based / Swing low]
**Take Profit:** [Fixed X pips / R:R ratio / Structure-based]
**Trailing Stop:** [X pips, activate after Y pips profit]
**Time-based Exit:** [Close at HH:MM GMT]

**Position Sizing:** [Fixed lot / % risk / ATR-based]
**Max Positions:** [Total / Per Symbol]
**Daily Loss Limit:** [-$X or -Y%]
**Max Drawdown Cutoff:** [Z%]
**Max Trades/Day:** [N]

**Time Filters:** [Session hours, blackout days]
**Spread Filter:** [Max spread in points]
**News Filter:** [Block N minutes before/after events]

**Broker:** [Name, execution type]
**Magic Number:** [Unique ID]
**Slippage:** [X points]

**Backtest Period:** [Start date - End date]
**Min Trades Required:** [N]
**Profit Factor Target:** [X]
**Max Drawdown Target:** [Y%]
**Demo Test Period:** [Z days]

Ready to Build Your Custom MT4 EA?

Use the template above, then send us your spec. We'll review it and provide a fixed-price quote within 24 hours.

Submit Your EA Spec