Expectancy Calculator Teacher
Win rate alone answers the wrong question. A system that wins only 30% of the time can still be strongly profitable if its winners are large enough relative to its losers, and a system that wins 70% of the time can still lose money if its losers are large enough. Expectancy - the average dollar result per trade - is the number that actually answers "is this worth trading", and this script walks through computing it one labelled step at a time rather than presenting a single unexplained figure. It computes, in order: the win/loss split, the average win and average loss size, expectancy per trade in account currency, expectancy expressed in R (using the average loss as the R unit), profit factor, and - only when trade-by-trade data is available, which manual typed numbers cannot provide - the System Quality Number (SQN), a measure of how consistent the edge is, not just how large it is on average. Numbers can be typed manually for a quick classroom pass, or pulled directly from this account's own closed trade history so a trader can see the real arithmetic behind their own results. Notes and limitations - Expectancy assumes future trades resemble the sample it was computed from. A 20-trade sample and a 500-trade sample can print the identical expectancy figure with very different confidence behind it. - The System Quality Number is only computed in account-history mode with at least 2 matching trades and at least one loss (it needs the standard deviation of individual trade results, which manual summary numbers cannot supply). Manual mode prints "not available" for this step rather than a fabricated figure. - Profit factor and expectancy-in-R are reported as undefined when the sample contains no losing trades, rather than silently dividing by zero.
Script · MT4 · v1.0 · Free
About Expectancy Calculator Teacher
Expectancy Calculator Teacher 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 Use account history, Magic filter and Symbol filter. MQL source code included.
Files in the download: ExpectancyCalculatorTeacher.mq4, ExpectancyCalculatorTeacher.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Use account history | false | If true, compute everything from this account's own closed history |
| Magic filter | -1 | Account-history mode only: magic filter (-1 = all) |
| Symbol filter | Account-history mode only: symbol filter ("" = all) | |
| Manual win rate pct | 45.0 | Manual mode: win rate, percent |
| Manual avg win | 150.0 | Manual mode: average winning trade, in account currency (positive) |
| Manual avg loss | 100.0 | Manual mode: average losing trade MAGNITUDE, in account currency (positive) |
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 Script · MQL4 Source Code