Execution Model Teaching EA
The same gross trading result can look very different net of costs depending purely on how those costs are charged. This EA makes that concrete: a single synthetic sequence of GROSS trade outcomes (a fixed win rate, fixed target and stop in points, generated once with a seeded random source) is run through five cost models at once, so every model sees the identical gross trades and only the deduction differs. Money-per-point is computed from MODE_TICKVALUE and MODE_TICKSIZE read live for the attached symbol, never from an assumed contract size - the same points-to-money conversion this catalogue uses everywhere trading money is calculated, since Gold, an index and a JPY cross all convert differently. The lot size is normalised to the broker's own min/max/step grid before use, exactly as a real order would be, even though no order is ever sent. The five models are: gross with no costs at all; a fixed spread in points charged once per trade; a live spread snapshot taken from MODE_SPREAD at the moment the EA runs; a fixed commission per lot, per round turn; and a percentage of the trade's notional value (lots times the broker's own MODE_LOTSIZE contract size times the current price). The CSV report lays out the cumulative net result of all five side by side, trade by trade, plus a final summary. Notes and limitations - Report-only. No order is ever sent; every "trade" is a synthetic gross point outcome with a cost model applied arithmetically. - The "live spread snapshot" model uses ONE reading of MODE_SPREAD, taken once when the simulation runs - it demonstrates what a constant real-world spread figure would have cost, not a spread that varies trade to trade the way a live account's actually does. - The synthetic trade sequence is a fixed win-rate, fixed target/stop model. It says nothing about any real strategy's actual results - use this EA to compare cost MODELS against each other on identical gross trades, not to estimate a real strategy's net profitability. - The simulation runs exactly once, on the first tick after attach. Changing an input requires removing and re-attaching the EA to re-run with the new values.
Expert advisor · MT4 · v1.0 · Free
About Execution Model Teaching EA
Execution Model Teaching EA is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Num trades, Win rate percent and Target points. MQL source code included.
Files in the download: ExecutionModelTeachingEa.ex4, ExecutionModelTeachingEa.mq4, ExecutionModelTeachingEa.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Num trades | 300 | Number of synthetic trades to simulate (capped, see .txt) |
| Win rate percent | 45.0 | Probability a synthetic trade is a winner |
| Target points | 200 | Gross points gained on a winning trade |
| Stop points | 100 | Gross points lost on a losing trade |
| Lot size | 0.10 | Lot size used for every synthetic trade (normalised to the broker's grid) |
| Random seed | 42 | Seed for MathSrand - same seed reproduces the same run |
| Fixed spread points | 20 | "Fixed spread" model: constant spread charged once per trade |
| Commission per lot round turn | 7.0 | "Fixed commission" model: currency units per lot, per round turn |
| Commission percent of notional | 0.01 | "Percentage of notional" model: percent of trade notional value |
| Report file name | ExecutionModelTeachingEa_report.csv | Report file, written under MQL4\Files\ |
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 → Scripts.
- 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 script onto a chart to run it once.
Tags: Alerts · MT4 Expert Advisor · MQL4 Source Code