Skip to content
All library documents

Recording Gold Symbol Costs and Contract Settings Before MT5 Backtests

Article MQL5 code base

Summary

This document describes an open-source MetaTrader 5 script that records a snapshot of a broker’s current symbol and account settings, with XAUUSD and GOLD as the main examples. Its report includes bid and ask, spread, price precision, tick and contract values, volume limits, stop and freeze levels, swap rates, trading and order modes, currencies, and selected account details. It can also save key-value data locally as a CSV file.

The suggested use is to compare broker-specific contract settings with those assumed in a Strategy Tester report before trusting or comparing expert-advisor results. The document emphasizes that symbol definitions and trading conditions can change how a test should be interpreted, and recommends realistic spread, commission, leverage, and server-time assumptions. This utility records conditions at one moment; it does not execute trades, generate signals, measure slippage, or capture how spreads change over time. A separate logger would be needed to study spread behavior across sessions.

Key ideas

  • Broker-specific contract and trading settings can affect the interpretation of a backtest.
  • The script records symbol, spread, volume, swap, order, and account details in a report or local CSV.
  • A snapshot can be compared with the assumptions used in a Strategy Tester run.
  • Realistic spread, commission, leverage, and server-time assumptions matter when assessing results.
  • A single snapshot does not measure slippage or future spread variation.

Tags

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