Skip to content
All library documents

Calculating Broker Commissions in MetaTrader 5 Strategy Tests

Article MQL5 code base

Summary

This document describes an external Expert Advisor intended to estimate broker commissions during MetaTrader 5 strategy tests when the platform’s built-in commission feature does not produce the desired result. It says the tool supports market, limit, stop-limit, and stop-market orders, with order type selected through an input. The user can enter a percentage fee, then run the EA in the strategy tester alongside entry, stop-loss, and take-profit settings.

The example applies a stated 0.04% commission to deal values and sums the resulting charges, then reports total commission in the tester’s Journal. The aim is to make test profit figures account for fees. The document gives an arithmetic example, not a comparison against broker statements or a validation across fee schedules. Accuracy depends on matching the broker’s actual commission basis and order handling; the source also notes that programming knowledge may be needed to use the code.

Key ideas

  • The proposed Expert Advisor estimates commission externally during MetaTrader 5 strategy tests.
  • It supports several order types and allows the user to specify a percentage fee.
  • The example adds deal-level commission amounts and prints a total in the tester Journal.
  • The document provides no validation against broker records, so fee assumptions must match the broker’s schedule.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.