Compiling Errors

 
Hello guys. I am having a problem compiling this code. When I leave out the closing parenthesis I get only two errors. But when I include it I get 26 errors. Could you please help me by going through it and highlight for me anything that I may have missed? thanks! PS. "Createtline" is a function to create trendlines.
//+------------------------------------------------------------------+
//|                                     Sqrt Factor Envelopes ().mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <C:\Users\user\Desktop\FX\SourceCode\MQL5\Include\Mql5Book\CreateObject.mqh>

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
class Anotherbar
{
   private:
      MqlRates rates[];
      datetime lastime;
      datetime lastimebutone;
      
   public:
      void Anotherbar();
      bool checknewbar(string _Symbol,ENUM_TIMEFRAMES _Period);
      
};

void Anotherbar::Anotherbar(void)
{
   ArraySetAsSeries(rates, true);
}

bool Anotherbar::checknewbar( string _Symbol,ENUM_TIMEFRAMES _Period)
   {
      bool firstrun=false,newBar=false;
      CopyRates(_Symbol,_Period,0,5,rates);
      
      if(lastime==0) firstrun=true;
      
      if (rates[0].time>lastime)
         {
            if (firstrun==false) newBar=true;
            lastime=rates[0].time;
            
         }
         
     return (newBar);
     
    }

void OnTick()
  {
  
  Anotherbar PlusOne;
bool onenewbar=false;

onenewbar=PlusOne.checknewbar(_Symbol, _Period);

if (onenewbar==true)
   {

//For the upper sqrts      
double onedayago = rates[1].high;
double highfactor=onedayago+(MathSqrt(MathSqrt(onedayago)));
string Trend="Higher root. Actual high= ("+rates[2].high+")";

double twodaysago=(rates[2].high)+MathSqrt(MathSqrt(rates[2].high));

Createtline(Trend,rates[2].time,twodaysago,rates[1].time,onedayago);


//For the lower sqrts
double yesterperiod = rates[1].low;
double lowfactor=yesterperiod+(MathSqrt(MathSqrt(yesterperiod)));
string Trendname="Lower root. Actual low= ("+rates[2].low+")";

double yesterperiodbutone=(rates[2].low)+MathSqrt(MathSqrt(rates[2].low));

Createtline(Trendname,rates[2].time,yesterperiodbutone,rates[1].time,yesterperiod);
   }
   

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 

The Createline() Function is missing.

Your missing one parenthesis to close OnTick() Function.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
Marco vd Heijden:

The Createline() Function is missing.

Your missing one parenthesis to close OnTick() Function.

The Createtline function is at the top of the EA in an include file.


Without the closing parenthesis, I get only two errors, as in the first picture below.

With the closing parenthesis, I get the errors as in the second picture.

 

You have to close the OnTick() function.

Use the styler.

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
{

   Anotherbar PlusOne;
   bool onenewbar=false;

   onenewbar=PlusOne.checknewbar(_Symbol, _Period);

   if (onenewbar==true)
      {

//For the upper sqrts
         double onedayago = rates[1].high;
         double highfactor=onedayago+(MathSqrt(MathSqrt(onedayago)));
         string Trend="Higher root. Actual high= ("+rates[2].high+")";

         double twodaysago=(rates[2].high)+MathSqrt(MathSqrt(rates[2].high));

         Createtline(Trend,rates[2].time,twodaysago,rates[1].time,onedayago);


//For the lower sqrts
         double yesterperiod = rates[1].low;
         double lowfactor=yesterperiod+(MathSqrt(MathSqrt(yesterperiod)));
         string Trendname="Lower root. Actual low= ("+rates[2].low+")";

         double yesterperiodbutone=(rates[2].low)+MathSqrt(MathSqrt(rates[2].low));

         Createtline(Trendname,rates[2].time,yesterperiodbutone,rates[1].time,yesterperiod);
      }
}
//+------------------------------------------------------------------+