Skip to content
All library documents

Mapping Broker Symbol Variants with Levenshtein Distance

Article MQL5 code base

Summary

The document describes a utility for adapting configured symbol names to broker-specific variants in MetaTrader 5. It compares a requested name with symbols visible in Market Watch using Levenshtein distance, then selects the closest match. For example, a strategy configured for a base currency pair could be mapped to a broker’s suffixed version, reducing failures caused by naming differences in multi-symbol Expert Advisors.

The evidence is the author’s report that the approach worked in personal projects, plus a practical integration scenario. No benchmarks, code details, or accuracy measurements are provided. Similar spelling does not guarantee that two symbols represent the same instrument, so automatic selection may be unsafe when brokers list closely named but materially different contracts. The author also notes that other approaches may better suit particular projects; the method is offered as a reference and learning example, not a universally validated solution.

Key ideas

  • Levenshtein distance can rank broker symbols by textual similarity to a configured name.
  • Market Watch symbols can be searched to resolve broker-specific suffixes or naming conventions.
  • The technique is aimed at configurable, multi-symbol Expert Advisors and development-time validation.
  • A closest string match does not establish that two symbols refer to the same instrument.

Tags

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