Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

Profit Concentration Analyzer - script for MetaTrader 5

Real Author
Published by:
Cristian David Castillo Arrieta
Cristian David Castillo Arrieta
Finance and International Business professional with a specialization in Financial Management. Self-taught MQL5 and Python developer focused on algorithmic trading, multi-asset portfolio construction, and quantitative risk management.
Views:
54
Rating:
(1)
Published:
ProfitConc.mq5 (15.53 KB) view
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Profit1


Net profit and win rate tell you how much a strategy made, not where that profit came from. A system can show a strong net result while a few lucky trades, or one explosive day, carry almost the entire profit. Profit Concentration Analyzer reads your closed trades and measures exactly that: how broad and repeatable the profit really is.

The script reads a CSV file with one row per closed trade and two columns, Date and Profit, and prints a full report in the Experts tab:

  • Concentration profile — how much of the gross profit comes from the top 1%, 5%, 10%, 25% and 50% of the winning trades.
  • Top-N share — the share of the net profit produced by the N largest trades.
  • Gini coefficient of the winning trades: a single 0-to-1 number for how unequal the gains are.
  • Survival test — removes the best few winners (a configurable percentage) and recomputes the net profit and profit factor, to show whether the edge survives without its outliers.
  • Day consistency — aggregates trades by day and compares the most profitable day against a prop-firm-style consistency limit (PASS/FAIL).
  • A composite score (A+ to F) combining concentration, consistency and survival, with written recommendations that point at the specific weakness.

Input. Place a CSV named in the input parameter (default Trades.csv) in the terminal MQL5\Files folder, with a header line "Date,Profit" and one row per closed trade. On the first run, if no file is found, the script generates a sample set and analyzes it, so you can see the output immediately. The included helper ExportTrades.mq5 writes that file from your trade history: copy its function into your Expert Advisor and call it from OnTester(), or run it as a standalone script on an account that already has trades.

Parameters. InpFileName (the CSV file), InpConsistencyLimit (largest-day limit as a percent of total profit), InpTopN (how many top trades the concentration figure uses), InpRemovePct (percentage of best winners removed in the survival test), and three weights InpWeightConc, InpWeightConsist and InpWeightSurv for the composite score.

Drawdown DNA Analyzer Drawdown DNA Analyzer

A native MQL5 script that analyzes the structure of an account's drawdowns, not just the single "maximum drawdown" figure. It reads a daily equity curve (Date,DailyPnL CSV), rebuilds the underwater curve, and splits it into individual drawdown episodes with their depth, duration and recovery time. It then reports the Ulcer Index, Pain Index, Recovery Factor and time spent underwater, and combines them into a single resilience score (A+ to F) with recommendations, printed in the Experts tab. No external libraries; if no file is found it generates a sample curve so it runs out of the box.

FVG Imbalance Marker Helper FVG Imbalance Marker Helper

A small educational MetaTrader 5 indicator that marks simple three-candle bullish and bearish Fair Value Gaps on the chart.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.