Wired Module Strategy Container
Most EAs hard-wire "which indicator generates the signal" and "how big is the trade" directly into OnTick(), so trying a different signal or a different sizing rule means editing and recompiling the source. This template separates those concerns into three module slots - signal, risk sizing and execution - each with more than one interchangeable implementation, and reads a config file (WiredModuleContainer.ini, created with sane defaults on first run) to decide which implementation of each slot is active for this run. MQL4 has no function pointers or interfaces to build a real dependency- injection container with, so the wiring is a string-keyed switch: the config's SignalModule/RiskModule/ExecModule values select a case inside ComputeSignal()/ComputeLots()/ComputeExecution(), and every module beneath those switches is otherwise fully independent of the others. Swapping the MA-cross signal for the breakout signal, or fixed lots for percent-equity risk sizing, is a one-line edit to the .ini file and a chart reattach - no recompile. The percent-equity risk module sizes from live MODE_TICKVALUE/MODE_TICKSIZE rather than an assumed contract size, so it sizes correctly on FX, metals and index CFDs alike; a zero or unreadable tick value falls back to the fixed-lots figure rather than sending a malformed order. Notes and limitations Only one position at a time is opened per magic+symbol; the container is a wiring demonstration, not a pyramiding or multi-position system. The breakout and MA-cross signals are intentionally simple reference implementations, not tuned strategies - study ComputeSignal()/ComputeLots()/ ComputeExecution() as the pattern to extend with real modules. Config parsing is forgiving: an unknown module name or malformed line is skipped with a printed warning rather than failing startup, so a typo degrades to the previous wiring instead of refusing to run.
Expert advisor · MT4 · v1.0 · Free
About Wired Module Strategy Container
Wired Module Strategy Container is an expert advisor (trading robot) for MetaTrader 4 based on Moving Average. It can size trades from your balance and risk percent and trades breakouts. It has 4 settings, such as Config file, Trade symbol and Magic. MQL source code included.
Files in the download: WiredModuleContainer.ex4, WiredModuleContainer.mq4, WiredModuleContainer.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Config file | WiredModuleContainer.ini | Config file under MQL4\Files\ (created with defaults if missing) |
| Trade symbol | Symbol to trade, blank = current chart symbol | |
| Magic | 48201 | Magic number for this EA's own orders |
| Slippage points | 30 | Max slippage, points |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Buy/Sell Arrows · Risk & Lot Size · Breakout · Moving Average · MT4 Expert Advisor · MQL4 Source Code