//+------------------------------------------------------------------+
//|                                                    TradeStat.mqh |
//+------------------------------------------------------------------+
#ifndef TRADESTAT_MQH
#define TRADESTAT_MQH
//+------------------------------------------------------------------+
//| Aggregated trade statistics for one symbol over one date range.  |
//| Populated by CTradeStatCalculator and consumed by the report     |
//| layout function that draws it into a PDF page.                   |
//+------------------------------------------------------------------+
struct CTradeStat
  {
   string            symbol;          // instrument the statistics cover
   datetime          from;            // start of the analyzed date range
   datetime          to;              // end of the analyzed date range
   int               total_trades;    // count of closed trades in range
   int               win_trades;      // count of trades with positive net profit
   int               loss_trades;     // count of trades with negative net profit
   double            win_rate;        // win_trades / total_trades, as a percentage
   double            gross_profit;    // sum of all positive trade net profits
   double            gross_loss;      // sum of all negative trade net profits, as a positive magnitude
   double            net_profit;      // gross_profit - gross_loss
   double            profit_factor;   // gross_profit / gross_loss; -1 means undefined (no losses)
   double            average_win;     // gross_profit / win_trades
   double            average_loss;    // gross_loss / loss_trades, as a positive magnitude
   double            expectancy;      // net_profit / total_trades
   double            max_drawdown;    // largest peak-to-trough decline in the equity curve
   double            equity_curve[];  // cumulative net profit after each closed trade, chronological
  };

#endif // TRADESTAT_MQH
//+------------------------------------------------------------------+