Architecture selector
Course context: This lesson belongs to a practical beginner curriculum for Pakistan.
| Route | Account/platform | Best fit | Main constraint |
|---|---|---|---|
| MT4 EA | MT4 account + desktop/VPS | Existing MQL4 strategy | MQL4 only; terminal must remain running |
| MT5 EA | MT5 account + desktop/VPS | MQL5 testing and execution | MQL5 only; not compatible with MT4 EA |
| Exness API | Eligible Exness-platform account | External language and infrastructure | No standard MetaTrader accounts; current standard endpoints exclude stocks/indices |
| Web/mobile | Manual monitoring/trading | Human workflow | No EA or script hosting |
Strategy specification before code
- Define exact symbol, timeframe and session.
- Specify entry using data available at decision time.
- Define invalidation, stop, target and time exit.
- Calculate volume from cash risk.
- Set spread, HMR, news and daily-loss filters.
- Specify retry, duplicate-order and disconnect behaviour.
- Define the state-reconciliation source after restart.
Realistic test model
| Input | Minimum treatment |
|---|---|
| Bid/Ask | Test the correct side of market, not midpoint only |
| Spread | Time-varying values including stressed windows |
| Commission/swap | Exact account and symbol rules |
| Slippage | Distribution from demo/live observations |
| Latency | Signal, request, acknowledgement and fill timestamps |
| Errors | Rejected, timed-out and duplicate response scenarios |
Controlled deployment ladder
- Unit-test calculations with known inputs.
- Backtest on in-sample and untouched out-of-sample periods.
- Run chart replay/manual verification.
- Forward-test on demo through normal and volatile sessions.
- Run on a VPS with monitoring but no real funds.
- If accepted, use the smallest practical live exposure and a hard kill switch.
Operational safeguards
- Maximum orders and exposure per symbol/account.
- Daily realised and equity drawdown stop.
- Spread and stale-price rejection.
- Idempotent order IDs and state reconciliation.
- Heartbeat alert for terminal/API/VPS failure.
- Manual close procedure if automation is disabled.
- Log retention for every signal and broker response.
Official references
Using Expert Advisors · Exness API eligibility and limits · Backtesting concepts
Questions from a first-time learner
Can an EA run in WebTerminal or Exness Trade?
No. EAs run only in MT4/MT5 desktop environments.
Can I install an MT4 EA in MT5?
No. MQL4 and MQL5 programs require platform-compatible versions.
Can a standard MetaTrader account use Exness API?
No. Current API access is for eligible Exness-platform accounts.
Does a VPS make an algorithm profitable?
No. It can improve uptime/latency consistency but cannot create positive expectancy.
