... Parameter passed as reference, variable expected

 

Hello, sorry my noob question but is the following:


in my LimitTakeProfit.mqh file, when I compile receive the following errors

'CSymbolInfo' - parameter passed as reference, variable expected LimitTakeProfit.mqh 55 56

'CArrayLong' - parameter passed as reference, variable expected LimitTakeProfit.mqh 56 56


'CArrayDouble' - parameter passed as reference, variable expected LimitTakeProfit.mqh 57 56


here is the variable declaration:

private:

   static CSymbolInfo       c_Symbol;

   static CArrayLong        i_TakeProfit; //fixed take profit

   static CArrayDouble      d_TakeProfit; //percent to close at take profit

  

here are the lines that create compilation error:


CSymbolInfo    CLimitTakeProfit::c_Symbol       =  new CSymbolInfo();

CArrayLong     CLimitTakeProfit::i_TakeProfit   =  new CArrayLong();

CArrayDouble   CLimitTakeProfit::d_TakeProfit   =  new CArrayDouble();


I understand that should be a very simple solution, but searching didn't found anything specific


Thanks in advance, best regards

Ferox875

 
  1. These are objects.
       static CSymbolInfo       c_Symbol;
       static CArrayLong        i_TakeProfit; //fixed take profit
       static CArrayDouble      d_TakeProfit; //percent to close at take profit

  2. You are creating handles to objects.
    CSymbolInfo    CLimitTakeProfit::c_Symbol       =  new CSymbolInfo();
    CArrayLong     CLimitTakeProfit::i_TakeProfit   =  new CArrayLong();
    CArrayDouble   CLimitTakeProfit::d_TakeProfit   =  new CArrayDouble();

  3. Just create the objects with whatever parameters are required.
    CSymbolInfo    CLimitTakeProfit::c_Symbol(…);
    CArrayLong     CLimitTakeProfit::i_TakeProfit(…);
    CArrayDouble   CLimitTakeProfit::d_TakeProfit(…);

 
William Roeder:
  1. These are objects.

  2. You are creating handles to objects.

  3. Just create the objects with whatever parameters are required.

William Roeder:
  1. These are objects.

  2. You are creating handles to objects.

  3. Just create the objects with whatever parameters are required.

Mr William Thanks a lot Man!
 
ferox875:
Mr William Thanks a lot Man!
How? can you help with some code examples, I am newbie in mql5 after some years in mql4 :(
 
Wacking my brain. But been out of coding for years. What exactly did you do ? Could you please let us know. Thanks in advance.
ferox875:
Mr William Thanks a lot Man!
Reason: