Loading…

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

SettingDefaultWhat it does
Pricing symbolSymbol to price pips/costs on (blank = current chart symbol)
A namePlan A
A win rate pct50.0Win rate, percent
A avg win pips20.0Average winning trade, pips
A avg loss pips20.0Average losing trade, pips
A lots0.10Lot size
A is longtrueTrue = long (uses long swap rate), false = short
A holding nights0Average nights held (swap charged this many times)
B namePlan B
B win rate pct50.0
B avg win pips20.0
B avg loss pips20.0
B lots0.10
B is longtrue
B holding nights0
Spread pips override0.0Spread to charge each plan, pips (0 = read the live spread)
Commission per lot0.0Round-turn commission per lot, account currency

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria