c++mql5mql

ctor error function already defined and has different type c++ or mql


i define class with ctor and use it in my code but compiler give me error

class MovingAvrage_Expert
{
public:
   MovingAvrage_Expert(void);
   ~MovingAvrage_Expert(void);
   bool Init(void);
   double TradeSizeOptimized(void);
   void CheckForOpen(void);
   void CheckForClose(void);
   bool SelectPosition();
}

MovingAvrage_Expert::MovingAvrage_Expert(void)
{
}

MovingAvrage_Expert::~MovingAvrage_Expert(void)
{
}

... more function

MovingAvrage_Expert maExpert;

// MQL Function

int OnInit(void)
{
   if (!maExpert.Init())
   {
      printf("Error creating indicator");
      return (INIT_FAILED);
   }
   return (INIT_SUCCEEDED);
}

void OnTick(void)
{
   if (maExpert.SelectPosition())
      maExpert.CheckForClose();
   else
      maExpert.CheckForOpen();
}

my error

'MovingAvrage_Expert' - function already defined and has different type Expert Advisors.mq5 48 22

where is my problem ?


Solution

  • just should write ; after class

    class MovingAvrage_Expert
    {
    public:
       MovingAvrage_Expert(void);
       ~MovingAvrage_Expert(void);
       bool Init(void);
       double TradeSizeOptimized(void);
       void CheckForOpen(void);
       void CheckForClose(void);
       bool SelectPosition();
    };
    

    :)