Download MetaTrader 5

Return array in function

To add comments, please log in or register
Track Market top sellers!
evertonalex
32
evertonalex 2015.08.26 05:08 

HI, 

 

I am trying return a MQLRates array in my function, but I get a error: 

class TradeLibrary

{

   private:

      MqlRates rates[]; 

   public:

      MqlRates getRates(); 

}; 

 

MqlRates TradeLibrary::getRates()

{

   return rates;  // this don't works

} 
Alain Verleyen
Moderator
30722
Alain Verleyen 2015.08.26 10:05  

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


Alain Verleyen
Moderator
30722
Alain Verleyen 2015.08.26 10:07  
evertonalex:

HI, 

 

I am trying return a MQLRates array in my function, but I get a error: 

You can't return an array. Please read the documentation :

The return operator can return the value of an expression located in this operator. If necessary, the expression value is converted to the function result type. What can be returned: simple types, simple structures, object pointers. With the return operator you can't return any arrays, class objects, variables of compound structure type.

To add comments, please log in or register