//+------------------------------------------------------------------+
//|                                                  RiskTypes.mqh   |
//|                        Shared enum and result struct for the     |
//|                        position sizing engine                    |
//+------------------------------------------------------------------+

#ifndef RISK_TYPES_MQH
#define RISK_TYPES_MQH

//+------------------------------------------------------------------+
//| ENUM_RISK_MODEL                                                  |
//| The set of risk models CPositionSizer can compute a lot size     |
//| under. Each model answers "how much do I risk on this trade" in  |
//| a different way; all of them ultimately convert to a lot size    |
//| through the same normalization path.                             |
//+------------------------------------------------------------------+
enum ENUM_RISK_MODEL
  {
   RISK_MODEL_FIXED_FRACTIONAL,   // risk a fixed percentage of account balance per trade
   RISK_MODEL_FIXED_MONETARY,     // risk a fixed money amount per trade, independent of balance
   RISK_MODEL_VOLATILITY_SCALED,  // risk a fixed percentage, with stop distance driven by ATR
   RISK_MODEL_EQUITY_CURVE        // fixed fractional, scaled down automatically during drawdown
  };

//+------------------------------------------------------------------+
//| CSizingResult                                                    |
//| Everything a caller needs after a sizing calculation, so nothing |
//| downstream has to re-derive the risk amount or reconstruct why   |
//| a particular lot size was chosen.                                |
//+------------------------------------------------------------------+
struct CSizingResult
  {
   bool              success;             // true if a usable lot size was computed
   double            lots;                // final lot size, normalized to the symbol's volume step
   double            risk_amount;         // target risk amount in account currency before normalization
   double            actual_risk_amount;  // actual risk amount at the normalized lot size
   double            stop_points;         // stop distance in points used for the calculation
   double            scaling_factor;      // multiplier applied to the base risk (1.0 unless equity-curve scaled)
   ENUM_RISK_MODEL   model_used;          // which risk model produced this result
   string            reason;              // human-readable description of the outcome or rejection

                     CSizingResult(void)
     {
      success              = false;
      lots                 = 0.0;
      risk_amount          = 0.0;
      actual_risk_amount   = 0.0;
      stop_points          = 0.0;
      scaling_factor       = 1.0;
      model_used           = RISK_MODEL_FIXED_FRACTIONAL;
      reason               = "";
     }

                    ~CSizingResult(void)
     {
     }
  };

#endif // RISK_TYPES_MQH
//+------------------------------------------------------------------+