TradeMath v1.00 - the arithmetic of your own trading history
Free script for MetaTrader 5 and MetaTrader 4. From https://www.fx4you.org/free/

WHAT IT DOES
It reads the closed trades of the account it runs on and prints five numbers:
  1. Expectancy: win % x average win - loss % x average loss = the average trade, and the profit factor.
  2. Costs: swap + commission + fees, as a share of the gross profit.
  3. Drawdown: the deepest fall of the closed-trade balance, and the gain needed to recover.
  4. Losing streak: the longest run of losses, and what it costs at 1 %, 2 % and 5 % risk per trade.
  5. Luck test: whether the average trade can be told apart from luck, and about how many trades it would take.
It is read-only: it opens, changes and closes nothing. It measures the past and predicts nothing.

INSTALL - MetaTrader 5
  1. In MetaTrader: File > Open Data Folder, then open MQL5 > Scripts.
  2. Copy MT5/TradeMath.ex5 there.
  3. In the Navigator, right-click Scripts > Refresh. Drag TradeMath onto any chart.

INSTALL - MetaTrader 4
  1. In MetaTrader: File > Open Data Folder, then open MQL4 > Scripts.
  2. Copy MT4/TradeMath.ex4 there.
  3. In the Terminal window open the Account History tab, right-click and choose "All History".
     (MT4 only sees what that tab shows.)
  4. In the Navigator, right-click Scripts > Refresh. Drag TradeMath onto any chart.

INPUTS
  From_Date, To_Date   the period (To_Date 0 = now)
  Magic_Filter         -1 = every trade; otherwise only one EA's magic number (0 = manual trades)
  Symbol_Filter        empty = every symbol; otherwise one symbol
  Save_Report          also write the report to a text file in the terminal's Files folder

WHERE THE RESULT APPEARS
On the chart, in the Experts tab, and (with Save_Report on) in a text file named TradeMath_<account>_<date>.txt.
The report and the file name contain your account number: remove it before you share the report with anyone.

LIMITS
  - Spread is paid inside the prices, so it is not in the cost line.
  - Deposits and withdrawals in the period are not separated from the balance curve.
  - The drawdown percentages start from the account's current balance minus the selected trades' net result.
    With Magic_Filter or Symbol_Filter they are approximate.
  - With fewer than 30 trades the luck test says only that there are too few trades.
  - Check the numbers against your broker's statement before you rely on them.

Trading involves risk. Past results do not guarantee future results. Nothing here is advice.
Free. Provided as is, without warranty.
