MQL4 struct containing adress to other structs

 

Hello everybody,


I need to code something like that but I dont know the right syntax in the second structure to have fields containing address to structure of first type.

Thanks

Janfi

struct ConditionSet
  {
      int            CondsNbr;  // Nombre de conditions dans le set
      bool           TabConds         [MaxConditions];
      string         TabCondsLabel    [MaxConditions];
      int            CandleNum        [MaxConditions];
      bool           ExitCondition;
      int            int1, int2, int3, int4, int5; // user integers
      double         d1, d2, d3,d4, d5; // user doubles
  };

struct Transaction
  {
      string         Strategie_name;
      string         Symbol;

      bool           BuyReady;
      bool           SellReady;

      bool           BuyRunning;
      bool           SellRunning;

      ConditionSet  & conditionsAchat;   // HERE THIS IS NOT THE CORRECT SYNTAXE
      ConditionSet  & conditionsVente;   // HERE THIS IS NOT THE CORRECT SYNTAXE

      int            ticketAchat;
      int            ticketVente;
  };
 
MQx does not have pointers, only handles to classes. What you want can't be done.
 

ok, thank you William, I did found another solution with arrays for ConditionSet ( 1 for buy 1 for sell ) and the array index instead of pointers in Transaction .