Clean EA Skeleton
Most of the bugs that show up in published Experts are the same handful of mistakes repeated: loops over open trades that silently skip half the book, trade results that are never checked against retryable versus permanent error codes, lot sizes that are never normalised to the symbol's step, and stops sent inside the broker's minimum distance. This skeleton handles all of that once, in one place, so a new EA can start from working plumbing rather than debugging the same traps again under time pressure. It ships as a genuinely working EA, not an empty shell: a plain fast/slow EMA crossover opens one position at a time with a normalised stop-loss and take-profit, so the skeleton compiles, runs, and can be tested end to end exactly as downloaded. Everything specific to a real strategy is isolated in two functions marked TEMPLATE POINT in the source - EvaluateSignal(), which decides whether to buy, sell, or do nothing, and ManageOpenPosition(), left empty, for a trailing stop or a signal-driven exit if the strategy needs one beyond the fixed stop and target already sent with the order. Notes and limitations - The placeholder signal has no claimed edge; it exists only to prove the plumbing works end to end. - One position at a time by design; a builder who needs a scale-in or multi-symbol EA should start from the relevant framework elsewhere in this catalogue instead of extending this one. - ManageOpenPosition() is empty on purpose - the skeleton relies only on the stop-loss and take-profit sent with the order until a builder adds more. - Requires AutoTrading enabled and trading permitted at the terminal, account and program level; if trading is disabled the EA logs it and places nothing. - On MQL5 netting, this EA refuses a new entry outright if a foreign- magic position already sits on the symbol, rather than risk merging into it.
Expert advisor · MT4 · v1.0 · Free
About Clean EA Skeleton
Clean EA Skeleton is an expert advisor (trading robot) for MetaTrader 4 based on Moving Average. It has 9 settings, such as Lots, Fast ma period and Slow ma period. MQL source code included.
Files in the download: EaSkeleton.ex4, EaSkeleton.mq4, EaSkeleton.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 |
|---|---|---|
| Lots | 0.01 | Fixed lot size for the placeholder signal - replace with real sizing |
| Fast ma period | 10 | Fast moving average period for the placeholder signal |
| Slow ma period | 30 | Slow moving average period for the placeholder signal |
| Stop loss pips | 30 | Stop loss per trade, in pips |
| Take profit pips | 45 | Take profit per trade, in pips (0 = none) |
| Magic number | 20260826 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per order action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
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: Risk & Lot Size · Moving Average · MT4 Expert Advisor · MQL4 Source Code