Building Custom Expert Advisors with Logging and Indexed Market Data
Summary
This article explains how to extend the CStrategy trading engine with custom Expert Advisors and supporting classes. It presents a Singleton logger that stores typed messages with timestamps, source information, and error details, and describes accessing market quotes through familiar index-style references. The framework also supports object-oriented indicators and strategy-specific methods that can be overridden to define trading logic.
Examples include a two-moving-average strategy and a Bollinger Band channel breakout strategy, along with guidance on loading strategies into a trading engine. The material focuses on software architecture and implementation patterns rather than evaluating trading performance. It does not provide comparative backtest evidence or establish that either example is profitable; the examples illustrate how to organize and connect strategy components in MetaTrader 5.
Key ideas
- A shared Singleton logger can collect messages from different parts of an Expert Advisor with useful context.
- Message objects can record type, source, timestamps, and system or trading error codes.
- Indexed accessors can provide familiar references to market series data in MetaTrader 5.
- Custom strategies define their trading rules by overriding methods in the CStrategy framework.
- Moving-average and Bollinger Band examples illustrate how custom strategies can be loaded into a trading engine.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.