//+------------------------------------------------------------------+
//|                                             RollingPFTypes.mqh   |
//|                                         Shared data structures   |
//+------------------------------------------------------------------+
#ifndef ROLLING_PF_TYPES_MQH
#define ROLLING_PF_TYPES_MQH

//--- sentinel value used when Gross Loss is effectively zero
#define ROLLING_PF_INFINITE 999.0

//--- sentinel value used when a window has no realized result at all (Gross
//--- Profit and Gross Loss both effectively zero); mathematically undefined,
//--- not a genuine breakeven, so it must be distinguished from PF = 1.0
#define ROLLING_PF_UNDEFINED (-1.0)

//+------------------------------------------------------------------+
//| Lightweight representation of one completed trade                |
//+------------------------------------------------------------------+
struct STradeRecord
  {
   datetime          close_time;   // time the position was closed
   double            net_profit;   // realized profit including commission and swap
  };

//+------------------------------------------------------------------+
//| One computed observation in the rolling Profit Factor series     |
//+------------------------------------------------------------------+
struct SRollingPFRecord
  {
   int               end_index;      // index of the last trade in this window
   datetime          end_time;       // close time of the last trade in this window
   double            gross_profit;   // sum of winning trades in this window
   double            gross_loss;     // absolute sum of losing trades in this window
   double            profit_factor;  // gross_profit / gross_loss, with edge-case handling
   int               win_count;      // number of winning trades in this window
   int               loss_count;     // number of losing trades in this window
  };

#endif // ROLLING_PF_TYPES_MQH
//+------------------------------------------------------------------+