Loading…

Multi Symbol EA Framework

A single-symbol EA cannot simply be pointed at several symbols: it only ever receives OnTick() for the chart it is attached to, the bare series functions like iMA() and Time[] only ever describe that chart's own symbol, and running several independent EAs to cover several symbols means several independent magic numbers to keep straight by hand. This framework solves those three problems once. Every symbol in InpSymbolList is validated against the broker with SymbolSelect() at startup - typos or symbols the account cannot trade are logged and skipped rather than silently stopping the whole EA - and assigned a magic number derived from InpMagicBase plus its position in the list, so each symbol's orders stay separable without a second input for every extra symbol. Because a non-chart symbol never fires OnTick(), the framework scans every accepted symbol from OnTimer() instead, checking each one's own new-bar state with iTime(symbol, 0, 0) rather than the chart's Time[] array, and reading every indicator and price with an explicit symbol argument. OnTick() itself is left empty on purpose, with a comment explaining why, since relying on it here would silently limit the EA to reacting only when its own chart's symbol moves. The signal is the same fast/slow EMA crossover used by the single-symbol skeleton elsewhere in this catalogue, deliberately unremarkable - the point of this framework is the multi-symbol scaffolding, not the signal. Replace EvaluateSignal() at the TEMPLATE POINT with a real one; it already receives the symbol it needs to evaluate as a parameter. Notes and limitations - Every symbol is scanned on the same timer interval; a symbol whose own timeframe closes bars faster than InpScanIntervalSec can miss the exact bar-close tick, though it will still catch the new bar on the next scan. - Order-pool loops filter by both symbol and magic number together, so it is safe to run several instances of this framework, or mix it with single-symbol EAs, on the same account. - Signal has no claimed edge; it exists only to prove the multi-symbol scaffolding trades correctly end to end. - Requires AutoTrading enabled and IsTradeAllowed() true; if trading is disabled the EA logs it and places nothing.

Expert advisor · MT4 · v1.0 · Free

About Multi Symbol EA Framework

Multi Symbol EA Framework is an expert advisor (trading robot) for MetaTrader 4 based on Moving Average. It has 11 settings, such as Symbol list, Lots and Fast ma period. MQL source code included.

Files in the download: MultiSymbolFramework.ex4, MultiSymbolFramework.mq4, MultiSymbolFramework.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Symbol listEURUSD,GBPUSD,USDJPYComma-separated symbols to trade, exactly as named in Market Watch
Lots0.01Fixed lot size per symbol - replace with real per-symbol sizing
Fast ma period10Fast moving average period for the placeholder signal
Slow ma period30Slow moving average period for the placeholder signal
Stop loss pips30Stop loss per trade, in pips
Take profit pips45Take profit per trade, in pips (0 = none)
Magic base20260827Base magic number - each symbol gets InpMagicBase + its index in the list
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per order action before giving up
Retry wait ms500Pause between attempts, milliseconds
Scan interval sec15Seconds between per-symbol signal checks

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Buy/Sell Arrows · Multi-Currency · Moving Average · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria