Two Plan Expected Value Comparator
Two trade plans are usually compared by eye - "this one has a better win rate" or "this one has a better reward-to-risk" - without ever combining those numbers with the actual cost of trading them. A plan with the better win rate on paper can still have the worse expected value once spread, commission and swap are subtracted, especially when it targets a smaller pip move or holds longer and pays more swap nights than the other. Both plans are typed in as a win rate percentage and an average win/loss in pips, with their own lot size and holding period. Gross expected value is win rate times average win minus loss rate times average loss; costs are then subtracted at each plan's own lot size, so the two plans need not use the same lot size to be compared honestly in money terms. Every pip-to-money conversion goes through the pricing symbol's own tick value and tick size, never a hardcoded contract size. Swap direction (long or short) is set per plan and read from the symbol's own MODE_SWAPLONG/MODE_SWAPSHORT, honouring whichever unit the broker publishes swap in (points or money-per-lot) rather than assuming one. The script flags a plan whose gross edge is positive but whose net expected value is not - the case where costs alone erase an apparent edge, easy to miss when eyeballing win rate and payoff alone. Notes and limitations - Win rate and payoff are typed estimates, not measured from real trade history - the comparison is only as reliable as those two numbers. - Spread is a single snapshot (or a typed override), not a distribution; a plan that trades during volatile spread widening will see a worse real-world cost than this estimate. - Costs assume one open and one close per trade; a plan that scales in or out with multiple fills would need its lot size adjusted by hand. - This is a paper comparison of two plans as described - it does not read or place any live orders.
Script · MT4 · v1.0 · Free
About Two Plan Expected Value Comparator
Two Plan Expected Value Comparator is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 17 settings, such as Pricing symbol, A name and A win rate pct. MQL source code included.
Files in the download: TwoPlanEvComparator.mq4, TwoPlanEvComparator.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Pricing symbol | Symbol to price pips/costs on (blank = current chart symbol) | |
| A name | Plan A | |
| A win rate pct | 50.0 | Win rate, percent |
| A avg win pips | 20.0 | Average winning trade, pips |
| A avg loss pips | 20.0 | Average losing trade, pips |
| A lots | 0.10 | Lot size |
| A is long | true | True = long (uses long swap rate), false = short |
| A holding nights | 0 | Average nights held (swap charged this many times) |
| B name | Plan B | |
| B win rate pct | 50.0 | |
| B avg win pips | 20.0 | |
| B avg loss pips | 20.0 | |
| B lots | 0.10 | |
| B is long | true | |
| B holding nights | 0 | |
| Spread pips override | 0.0 | Spread to charge each plan, pips (0 = read the live spread) |
| Commission per lot | 0.0 | Round-turn commission per lot, account currency |
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