Expectancy Trend Report
A single lifetime expectancy figure hides drift. A system whose edge quietly decayed six months ago can still show a positive all-time average, because the strong early months outweigh the recent weak ones in a plain sum - the number looks fine right up until it does not. This script groups closed trades by calendar month and computes each month's expectancy the standard way: (win rate * average win) minus (loss rate * average loss), in account currency. Alongside the raw monthly figure it computes a rolling average across a configurable window of months, which smooths single-month noise while still tracking a genuine multi-month decline. Both numbers, plus trade count and win rate, go into a CSV; a companion text file repeats the same numbers next to a fixed-width ASCII bar per month, so a spreadsheet is not required just to see whether the trend line is climbing or sliding. Notes and limitations Expectancy is computed in account currency, not in R-multiples, so it is not directly comparable across symbols with very different position sizing unless lot sizing was already consistent. Months with very few trades produce a noisy expectancy figure - the rolling column exists specifically to reduce that noise, but a two- or three-trade month can still swing it sharply. The ASCII bar is a quick-glance aid scaled to the largest monthly figure in the range, not a precisely calibrated chart.
Script · MT4 · v1.0 · Free
About Expectancy Trend Report
Expectancy Trend Report is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as From date, To date and Current symbol only. MQL source code included.
Files in the download: ExpectancyTrendReport.mq4, ExpectancyTrendReport.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| From date | 0 | From close time (1970.01.01 = all history) |
| To date | 0 | To close time (1970.01.01 = up to now) |
| Current symbol only | false | Only this chart's symbol |
| Magic filter | -1 | Magic number filter (-1 = all) |
| Rolling window months | 3 | Months averaged into the rolling expectancy column |
| Output folder | ExpectancyTrendReport | Subfolder 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: Trend · Alerts · MT4 Script · MQL4 Source Code