member function not defined

 

Maybe Someone can help me

I have a problem with compiling and the error message is that "member function not defined"...

Thanks for helping me

here my Code:

class CPeriodCalculator
  {
private:
   double high[];
   double low[];
   double open[];
   double close[];

public:
                  CPeriodCalculator(void);
                  ~CPeriodCalculator(void);   
   int            SetMAPeriod(string pSymbol, ENUM_TIMEFRAMES pPeriod, string pSpeed,double pX, double pY); 
   int            SetMAPeriod_Current(string pSymbol, ENUM_TIMEFRAMES pPeriod, string pSpeed, double pX, double pY); 
   

                    
  };
//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CPeriodCalculator::CPeriodCalculator(void) 
  {
      ArraySetAsSeries(high, true);
      ArraySetAsSeries(low, true);
      ArraySetAsSeries(open, true);
      ArraySetAsSeries(close, true); 
  }
 
  
//+------------------------------------------------------------------+
//|Function to Calculate the MA Periods                              |
//+------------------------------------------------------------------+
int CPeriodCalculator::SetMAPeriod(string pSymbol, ENUM_TIMEFRAMES pPeriod, string pSpeed, double pX, double pY) 
  {
      
      CopyHigh(pSymbol,pPeriod,0,2,high);
      CopyLow(pSymbol, pPeriod,0,2,low);
      CopyOpen(pSymbol, pPeriod,0,2,open);
      CopyClose(pSymbol, pPeriod,0,2,close);
      
      if (StringCompare(pSpeed,"fast",false) == 0)
         {
            return (MathRound( (1/30)* (((high[1] - low[1]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY))));
         }
      else if (StringCompare(pSpeed,"moderate",false) == 0)
         {
            return (MathRound(((high[1] - low[1]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY)));
         }
      else if (StringCompare(pSpeed,"slow",false) == 0)
         {
            return (2 * MathRound(((high[1] - low[1]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY)));
         }
      else return(-1);
  }
//+------------------------------------------------------------------+
//| Function to Calculate the MA Periods by highest High/lowest Low  |
//+------------------------------------------------------------------+
int CPeriodCalculator::SetMAPeriod_Current(string pSymbol, ENUM_TIMEFRAMES pPeriod, string pSpeed, double pX, double pY)
  {
      
      CopyHigh(pSymbol,pPeriod,0,2,high);
      CopyLow(pSymbol, pPeriod,0,2,low);
      CopyOpen(pSymbol, pPeriod,0,2,open);
      CopyClose(pSymbol, pPeriod,0,2,close);
      int maxIdx = ArrayMaximum(high);
      int minIdx = ArrayMinimum(low);
      
      if (StringCompare(pSpeed,"fast",false) == 0)
         {
            return (MathRound( (1/30)* (((high[maxIdx] - low[minIdx]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY))));
         }
      else if (StringCompare(pSpeed,"moderate",false) == 0)
         {
            return (MathRound(((high[maxIdx] - low[minIdx]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY)));
         }
      else if (StringCompare(pSpeed,"slow",false) == 0)
         {
            return (2 * MathRound(((high[maxIdx] - low[minIdx]) / _Point) * pX + MathAbs(((open[1] - close[1]) / _Point) * pY)));
         }
      else return(-1);
  }
  
//+------------------------------------------------------------------+
//| Destructor                                                       |
//+------------------------------------------------------------------+
CPeriodCalculator::~CPeriodCalculator(void)
  {
  } 
 
1531691:

Maybe Someone can help me

I have a problem with compiling and the error message is that "member function not defined"...

Thanks for helping me

here my Code:

I don't get this error when compiling the code you provided.
 
angevoyageur:
I don't get this error when compiling the code you provided.

Sorry my mistake...


I got this Problem when I try to call the function from my EA...


#include <Expert\BK\CPeriodCalculator.mqh>

//+------------------------------------------------------------------+
//| INPUT variables                                                  |
//+------------------------------------------------------------------+

//--- Input for pSymbols
input double   X_EURCHF    = 0.15;
input double   X_EURGBP    = 0.15;
input double   X_EURJPY    = 0.15;
input double   X_EURUSD    = 0.15;
input double   X_GBPJPY    = 0.15;
input double   X_GBPUSD    = 0.15;
input double   X_USDCHF    = 0.15;
input double   X_USDJPY    = 0.15;

input double   Y_EURCHF    = 0.2;
input double   Y_EURGBP    = 0.2;
input double   Y_EURJPY    = 0.2;
input double   Y_EURUSD    = 0.2;
input double   Y_GBPJPY    = 0.2;
input double   Y_GBPUSD    = 0.2;
input double   Y_USDCHF    = 0.2;
input double   Y_USDJPY    = 0.2;

//--- Inputs for MoneyManagement
input double             Money_FixLot_Percent          = 5;              // Percent
input double             Money_FixLot_Lots             = 0.5;            // Fixed volume

//+------------------------------------------------------------------+
//| Expert initialization variables                                  |
//+------------------------------------------------------------------+

//--- OBJECTS
CPeriodCalculator MAPeriod;

//--- ARRAYS
string sy[8];
double x[8];
double y[8];

int      tema_FastHandle[];
int      tema_ModerateHandle[];
int      tema_SlowHandle[];

//--- INTEGERS
int i = 0;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(60);

//--- Setting Arrays as series


//--- ARRAYS 
   sy[0]="EURCHF"; sy[1]="EURGBP"; sy[2]="EURJPY"; sy[3]="EURUSD"; sy[4]="GBPJPY"; sy[5]="GBPUSD"; sy[6]="USDCHF"; sy[7]="USDJPY";
   x[0]=X_EURCHF; x[1]=X_EURGBP; x[2]=X_EURJPY; x[3]=X_EURUSD; x[4]=X_GBPJPY; x[5]=X_GBPUSD; x[6]=X_USDCHF; x[7]=X_USDJPY;
   y[0]=Y_EURCHF; y[1]=Y_EURGBP; y[2]=Y_EURJPY; y[3]=Y_EURUSD; y[4]=Y_GBPJPY; y[5]=Y_GBPUSD; y[6]=Y_USDCHF; y[7]=Y_USDJPY; 


   int Z = MAPeriod.SetMaPeriod(sy[0], PERIOD_D1, "fast", x[0], y[0]);


//---
   return(INIT_SUCCEEDED);
  }
 
1531691:

Sorry my mistake...


I got this Problem when I try to call the function from my EA...


The method defined in your class is SetMAPeriod and not SetMaPeriod. mql5 is case sensitive.
 
angevoyageur:
The method defined in your class is SetMAPeriod and not SetMaPeriod. mql5 is case sensitive.
HA HA Thank YOU!!!
 

I see this is a rather old thread, but I am having the same trouble (and no, not a cAsE error).  Hopefully someone will see this; at wits end...

Using an include file for drawing objects on a chart, called IncGUI_v2.mqh, except I reformatted it and cleaned it up and it's now v3.  

In any case, that has all been working fine.  The main thing I use is a CTable object, which has a Show() and Hide() function.  But today I wanted to query if it was hidden and so I added code like this:


// Enabling visibility at a set position.

// \param int aLeft - X-coordinate (distance from the left side of the chart),

// \param int aTop - Y-coordinate (distance from the top side of the chart).

void Show(int aLeft, int aTop)

{

// Enabling the display at a set position

SetPos(aLeft, aTop); // Registration of the coordinates

Show(); // Enabling the display

}


// Hiding the control (deletion of graphical objects).

void Hide()

{

// Hiding (deletion of graphical objects)

m_Visible = false; // Registration of the visibility status

Delete(); // Deletion of graphical objects

ChartRedraw(); // Chart update

}


// Hiding the control (deletion of graphical objects).

bool IsVisible()

{

return(m_Visible);

}

Under public functions, the most basic thing, to return a member variable.  In my EA code, I use it like this:

CTable gTbl;

void BuildSessionStats()

{

string fn = "BuildSessionStats()";


if (!gTbl.IsVisible()) return; // ADDED THIS LINE TO CHECK

// Update Bid, Ask in case they change mid-run

UpdatePrices();

gTbl.Init("CTable", 200, 600);

gTbl.SetCollsCount(2);

gTbl.SetCollWidth(0, 85);

gTbl.SetCollWidth(1, 75);


(etc) . . .  

}


But when I compile, I get this error:

'IsVisible' - member function not defined StevesEA.mq4 1904 12



If I try instead to change it to a member function already in CTable, like this one:

int Width()

{

return (m_Width);

}


indeed I still get:

'Width' - member function not defined StevesEA.mq4 1904 12


These are all under the "public:" heading in the GUI file. 

If I try to call Hide() or Show(), it works fine.


Any ideas?




 

Attached is the include file if needed.

I cannot send the EA, so if necessary, I would need to make a sample EA...

Files:
IncGUI_v3.mqh  683 kb
 

Derk Wehler: But today I wanted to query if it was hidden and so I added code like this:

//      Hiding the control (deletion of graphical objects).
bool IsVisible()
{
return(m_Visible);
}
But when I compile, I get this error: 'IsVisible' - member function not defined StevesEA.mq4 1904 12

If I try instead to change it to a member function already in CTable, like this one:

int Width()
{
return (m_Width);
}

indeed I still get: 'Width' - member function not defined StevesEA.mq4 1904 12

  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your (original) post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. member function not defined StevesEA.mq4 1904 12
    Always post the relevant parts (variable declarations and code) and mark which line is 1904. There are no mind-readers here. We can't see your code unless you post it.

  3. class CInputBox
    :
            bool IsVisible()
            {
                    return(m_Visible);
            }
    :
            //      Control visibility.
            //      \return bool type. True/false - visible/hidden.
            bool Visible()
            {
                    return (m_Visible);
            }
    
    Certainly don't need two.

  4. There is no IsVisible() or Width() in CTable in the file you provided, thus "member function not defined."
    private:
       void SB()
       void CountTWidth()
       void CountTHeight()
       string iif(bool aBool, string aIfTrue, string aIfFalse)
       string its(int aValue)
       void GetRGB(color aColor, int  &aR, int  &aG, int  &aB)
       string WEBColor(color aColor)
       void Create()
       void Delete()
       void SetCrossColor(int aR, int aC, bool aNormal)
    public:
       void Init(string aName = "CTable", int aWidth = 200, int aHeight = 200)
       void AddRow()
       void DeleteRow(int aIndex)
       void Show(int aLeft, int aTop)
       void Show()
       void Hide()
       void Refresh()
       void SetPos(int aLeft, int aTop)
       void SetPosLeft(int aLeft)
       void SetPosTop(int aTop)
       int GetLeft()
       int GetTop()
       void SetWidth(int aWidth)
       void SetHeight(int aHeight)
       int GetWidth()
       int GetHeight()
       void SetCollsCount(int aCount)
       void SetCollWidth(int aCollIndex, int aWidth)
       void SetRowsCount(int aRowsCount)
       void Clear()
       void SetRowHeight(int aRowIndex, int aHeight)
       void SetCellText(int aRowIndex, int aCollIndex, string aText)
       void SetCellBGColor(int aRowIndex, int aCollIndex, color aBGColor)
       void SetCellTxtColor(int aRowIndex, int aCollIndex, color aTxtColor)
       void SetCellFont(int aRowIndex, int aCollIndex, string aFont = "Arial")
       void SetCellFontSize(int aRowIndex, int aCollIndex, int aFontSize)
       void SetCellsMerge(int aRowIndex, int aCollIndex, int aRowSpan, int aCollSpan)
       int GetCollsCount()
       int GetCollWidth(int aCollIndex)
       int GetRowsCount()
       int GetRowHeight(int aRowIndex)
       string GetCellText(int aRowIndex, int aCollIndex)
       color GetCellBGColor(int aRowIndex, int aCollIndex)
       color GetCellTxtColor(int aRowIndex, int aCollIndex)
       string GetCellFont(int aRowIndex, int aCollIndex)
       int GetCellFontSize(int aRowIndex, int aCollIndex)
       int Event(const int id, const long &lparam, const double &dparam, const string &sparam)
       string HTML()
       void SetTag(string aTag)
       string GetTag()
       void SetSubWindow(int aNumber)
       void SetSubWindow(string aName)
       int GetLastClickedRaw()
       int GetLastClickedColl()
       void SetAllowSelection(bool aValue)
       bool GetAllowSelection()

 

Thank you for responding, sorry about code thing, was not aware of that.

I did not originate this GUI include file; just cleaned it up, so I admit not being an expert on it.

But none of the classes appear to inherit from any other class, although a couple have member vars of the other classes, like this:

class CSpinInputBox
{
protected:
        CInputBox         m_ib;

Somehow it appears that I put the IsVisible() function in the wrong class... Very strange since I was sure yesterday... but yes, both of those are in CInputBox, whereas I meant to put it in CTable.

Either way, thank you; I would not have found it otherwise.