Forex Forum - EarnForex
Serving Traders Since 2005
 

Go Back   Forex Forum - EarnForex > MetaTrader > MetaTrader 5

MetaTrader 5 MT5 is already out of its beta stage, but the development is ongoing. Some brokers already offer real accounts and the interest of traders is growing. You can discuss anything related to MetaTrader 5 in this forum.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 5th October 2011, 06:39
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inheritance

Hi

I am getting compile time error when compiling REGCH.mqh, I can not understand why. please help.

thx


'STOCH_POPULT' - wrong parameters count REGCH.mqh 31 4

MQL5 Code:
class REGCH : public STOCH_POPULT

constructors:
MQL5 Code:
   REGCH(string sym, ENUM_TIMEFRAMES prd){first_run=true;}

and

MQL5 Code:
STOCH_POPULT::STOCH_POPULT(string sym, ENUM_TIMEFRAMES prd)
{
Reply With Quote
  #2 (permalink)  
Old 5th October 2011, 08:15
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

You should pass some string and timeframe as parameters.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #3 (permalink)  
Old 5th October 2011, 09:09
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Enivid View Post
You should pass some string and timeframe as parameters.
that happens during code running. do you mean it gives a compile time error but not run time error?
Reply With Quote
  #4 (permalink)  
Old 5th October 2011, 10:02
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Can you attach the while file here, please?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
  #5 (permalink)  
Old 5th October 2011, 10:08
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

both are constructors. don't they suppose to have the same signature?
Reply With Quote
  #6 (permalink)  
Old 5th October 2011, 15:25
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

MQL5 Code:
//+------------------------------------------------------------------+
//|                                                  myUtilities.mqh |
//+------------------------------------------------------------------+


class STOCH_POPULT
{
protected:
   string _symbol;
   ENUM_TIMEFRAMES _period;
   ushort bars;
   bool first_run;
   double low[300];

public:
   STOCH_POPULT(string sym, ENUM_TIMEFRAMES prd)
   {
      bars = ArraySize(low);
   };
   
   ~STOCH_POPULT(){};


};

MQL5 Code:
//+------------------------------------------------------------------+
//|                                                        REGCH.mqh |
//+------------------------------------------------------------------+
#include <myUtilities.mqh>
class REGCH : public STOCH_POPULT
  {
private:    //-----------------------------------------
   
public:     //-----------------------------------------
   REGCH(string sym, ENUM_TIMEFRAMES prd)
   {
      _symbol = sym;
      _period = prd;  
      first_run=true;
   }
   ~REGCH();
   
   
  };
REGCH::~REGCH() { }
Reply With Quote
  #7 (permalink)  
Old 5th October 2011, 17:53
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

Add simple constructor to your STOCH_POPULT class. I don't know why, but it solves the problem:
MQL5 Code:
STOCH_POPULT(){};

Maybe a bug...
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:15.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Inactive Reminders By Icora Web Design

SEO by vBSEO 3.3.2