Prop Rule Backtest Auditor
MQL4 can only run one program's OnTick logic per chart, so an EA cannot literally "run" a second, arbitrary strategy inside the Strategy Tester to audit it - anything claiming to do that would be pretending. What an MQL4 program genuinely can do is replay an already-recorded sequence of closed trades against a mechanical ruleset, in order, exactly as they happened. That is what this auditor does: it reads a CSV trade log (the column layout DetailedTradeHistoryExporter produces - OpenTime, CloseTime, Type, Lots, Symbol, Profit - or any file matching it) and applies each record to a simulated account balance as the tester's clock reaches that record's close time. Four checks run against the replay: a daily loss limit measured against each simulated day's opening balance, a trailing maximum drawdown floor that stops trailing once the high water mark reaches the initial balance (matching typical funded programme terms), a consistency check capping how much of total profit any single day may represent, and a minimum qualifying trading day count using the same held-duration filter as MinimumTradingDaysTracker. The first daily-loss or drawdown breach, in chronological order, is the one that determines failure - later statistics are still computed for a complete picture, but the real account would have been shut down at that first breach, not later. Run inside the Strategy Tester across the log's own date range for a paced, tick-by-tick replay, or drag it onto any live or demo chart for an instant verdict - a historical log's close times are all in the past relative to "now", so the whole replay applies on the first tick in that case. An OnTester() implementation returns 1.0 for a pass and 0.0 for a fail, usable as a custom optimisation criterion if this auditor is itself run under optimisation across several candidate logs. Notes and limitations This audits a recorded trade sequence against mechanical rules; it does not generate trading signals and cannot audit a strategy that has not already produced a trade log. The log is capped at 2000 rows and each calendar day tracker at 400 distinct days - both generous for a single evaluation period, but a very long log should be trimmed to the period being audited. Confirm the exact wording of your own programme's rules; this implements the common versions of each check, and some programmes vary the details (for example, measuring consistency against the profit target rather than total realised profit).
Expert advisor · MT4 · v1.0 · Free
About Prop Rule Backtest Auditor
Prop Rule Backtest Auditor is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Trade log filename, Initial balance and Daily loss limit percent. MQL source code included.
Files in the download: PropRuleBacktestAuditor.ex4, PropRuleBacktestAuditor.mq4, PropRuleBacktestAuditor.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Trade log filename | PropRuleBacktestAuditor_TradeLog.csv | File in MQL4\Files, columns: OpenTime,CloseTime,Type,Lots,Symbol,Profit |
| Initial balance | 10000.0 | Starting balance for the simulated run |
| Daily loss limit percent | 5.0 | Daily loss limit, percent of that day's opening virtual balance |
| Max drawdown percent | 10.0 | Trailing max drawdown, percent of the initial balance |
| Lock drawdown at initial | true | Stop the drawdown floor trailing once the high water mark reaches the initial balance |
| Max single day profit percent | 30.0 | Consistency limit: max share of total profit any single day may represent |
| Required trading days | 10 | Minimum qualifying trading days required by the evaluation's end |
| Min trade duration secs for day | 60 | A logged trade must be held at least this long to count its day as qualifying |
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: Trailing Stop & Break-even · Alerts · MT4 Expert Advisor · MQL4 Source Code