... Parameter passed as reference, variable expected

To add comments, please log in or register
ferox875
34
ferox875  

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

William Roeder
22428
William Roeder  
  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(…);

ferox875
34
ferox875  
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!
tluszczofil
23
tluszczofil  
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 :(
To add comments, please log in or register