1. Courses
  2. Algo Trading
  3. Lesson 2
Back to CourseBack to Lesson 1
Beginner–Intermediate12–18 minLesson 2

MT5 Architecture for Algotrading

Understand account types, data and modeling, the Strategy Tester, spreads/fees, and logs — to run clean, realistic backtests.

Lesson Progress0%
2.1

Accounts & Market Data Basics

•Account types: demo vs live; netting vs hedging; leverage and contract sizes influence position sizing and costs.

•History and data quality: ensure sufficient bars and tick history for symbols/timeframes under test.

•Ticks vs minutes: tick-level modeling captures spread and intrabar dynamics; minute OHLC is faster but can distort scalpers.

•Modeling quality: choose the simplest method that does not misrepresent your system's logic.

Modeling Comparator
Compare tick vs minute modeling modes

Accurate intrabar events; slower; recommended for intraday/scalpers.

Pros

  • •Captures all intrabar price movements
  • •Accurate stop/take-profit triggers
  • •Best for scalping strategies

Cons

  • •Slowest execution
  • •Requires more processing power
  • •May not have broker tick data

When to Use

Intraday strategies (M1-H1) with intrabar logic like trailing stops or breakeven.

Runtime Impact:10-50x slower than OHLC
Always load enough history for IS/OOS windows; keep modeling consistent across runs.
2.2

Strategy Tester: Modeling, Spread, Fees

•Modeling modes: select accuracy based on strategy logic.

•Spread: set fixed spread or 'current' with buffer; spreads widen at rollover/news.

•Commissions/Swaps: include broker-specific round-trip commissions and overnight swaps.

•Multi-scenario tests: change one variable at a time; label runs and compare.

Tester Configurator
Configure your backtest parameters and see cost impact
1.0

Typical EURUSD spread: 0.5-1.5 pips

$7

ECN brokers typically charge $5-10/lot round-trip

$-1.2

Overnight holding cost; varies by broker and direction

Cost Per Trade

1.70
Total (pips)
$17.00
Total (USD/lot)
1.70
Break-even (pips)

For non-USD pairs, pip value differs — adjust accordingly.

Multi-Scenario Matrix
Cost per trade (pips + $) for each spread/commission combination
Spread \ Comm$0$7$14
0.5 pip
0.50 pips
($5)
1.20 pips
($12)
1.90 pips
($19)
1 pip
1.00 pips
($10)
1.70 pips
($17)
2.40 pips
($24)
1.5 pip
1.50 pips
($15)
2.20 pips
($22)
2.90 pips
($29)

Color scale: Green ≤1 pip | Amber 1-1.5 pips | Red >1.5 pips

Name and export each run clearly: include symbol, TF, modeling, dates, spread, commissions.
2.3

Journals, Logs, and Report Exports

•Journals: Terminal → Toolbox → Journal. Expert logs: Experts tab. Errors (trade context busy, no prices), slippage, requotes appear here.

•Reports: Tester → open completed run → 'Open report' (HTML/CSV) for sharing and analysis.

•Key metrics: Net profit, Profit factor, Max drawdown (abs/rel), Expectancy, Trades, Win rate, Avg trade, Sharpe (if present).

Log Decoder
Common log messages and their meanings
OrderSend OK (ticket 12345678)

→ Execution accepted

OrderSend error 4756

→ No prices/market closed

Slippage 1.2 points

→ Widened spread or latency

Not enough money

→ Position sizing exceeded

Modification rejected

→ Stop levels too tight

Swap charged -2.34

→ Overnight holding costs

Sample Reports

2.4

Practice: Your First Clean Backtest

Step APrepare
  • Install MT5 and open a demo (regulated broker).
  • Load history for EURUSD H1 (last 2–3 years).
  • Select a sample EA (e.g., 'Moving Average' from MT5 Examples).
Step BConfigure
  • Modeling: Every tick (or Real ticks if available)
  • Dates: 24 months IS + 6 months OOS (two runs)
  • Spread: 1.0 pip; Commission: $7/lot; Swap: −$1.2/lot/day
Step CRun & Export
  • Run IS, then OOS; compare key metrics (PF, Max DD, Expectancy).
  • Open HTML and CSV reports; save with labeled filenames.
Progress0 / 8 items

You can now run basic, realistic backtests and read logs/reports.

Lesson 2 Quiz

Mini-Quiz

Test your understanding with 3 questions. Pass with 2/3 correct.

Back to Lesson 1Next: Strategy Design

Educational content only. Not financial advice. Trading involves risk of capital loss. Past performance does not guarantee future results.