Error: Unexpected Token and Some Operator Expected

 

Hi

I am getting compilation error as below:

',' - unexpected token StrategyBase.mqh 51 16

'mSymbol' - some operator expected StrategyBase.mqh 51 9

expression has no effect StrategyBase.mqh 51 2

',' - unexpected token StrategyBase.mqh 51 23

',' - unexpected token StrategyBase.mqh 51 33

expression has no effect StrategyBase.mqh 51 24

',' - unexpected token StrategyBase.mqh 51 49

expression has no effect StrategyBase.mqh 51 34

')' - unexpected token StrategyBase.mqh 51 65

expression has no effect StrategyBase.mqh 51 50

6 errors, 4 warnings 7 5

//+-----------------------------------------------------------------------------------------------------------------------------+
//| INCLUDE:
//+-----------------------------------------------------------------------------------------------------------------------------+
  // CLASS: BASE
        #include "InputBase.mqh"                // InputBase CLASS WITH ALL PARAMETER VALUES
  // CLASS: AUXILIARY
        #include "../Auxiliary/Pivots.mqh"
  // CLASS: INDICATOR TREND
  #include "../../Indicator/Trend/iDBB.mqh"	// DOUBLE BOLLINGER BANDS

//+-----------------------------------------------------------------------------------------------------------------------------+
//| CLASS:        CStrategyBase.mqh
//| APPLICATION:  BASE CLASS TO SET INPUT PARAMETERS AND DEFINE STRATEGY COMMON METHODS
//+-----------------------------------------------------------------------------------------------------------------------------+
class CStrategyBase : CInputBase {

private:

protected:

        // CLASS INSTANCE: PIVOTS
        CPivots                                 pivots;

        // DOUBLE BOLLINGER BANDS: CLASS INSTANCES FOR DIFFERENT TIME FRAME
        CiDBB                                   dbbM01;
        CiDBB                                   dbbM05;
        CiDBB                                   dbbM15;
        CiDBB                                   dbbH01;

public:

        CStrategyBase(string pSymbol,double pRiskPerTrade = 1.00) : CInputBase(pSymbol,pRiskPerTrade) { }
 ~CStrategyBase() { }

        void                                    OnInit();
        void                                    OnTick();

}; // END of Class declaration
//+-----------------------------------------------------------------------------------------------------------------------------+
//| METHOD:       OnInit()
//| APPLICATION:  TO BE CALLED ONCED FROM CStrategyBase TO SET ASSIGN / DEFAULT VALUES
//+-----------------------------------------------------------------------------------------------------------------------------+
void CStrategyBase::OnInit() {

        // SET INDICATOR PARAMETERS OF CLASS: CInputBase
        SetParamDBB(21,2.0,0.75);

        pivots.SetParam(mSymbol);
        dbbM01(mSymbol,mTFM01,mBBPeriod,mBBDeviationOut,mBBDeviationInn); // CAUSING ERROR ...

} // END of parametric constructor method CStrategyBase()
//+-----------------------------------------------------------------------------------------------------------------------------+

The constructor in CiDBB is as follows:

public:

  CiDBB() : CIndicatorBase() { }
  CiDBB(string pSymbol,ENUM_TIMEFRAMES pTimeFrame,int pBBPeriod,double pBBDeviationOut,double pBBDeviationInn)
        : CIndicatorBase() { InitHandle(pSymbol,pTimeFrame,pBBPeriod,pBBDeviationOut,pBBDeviationInn); }
 ~CiDBB();

Any clues what I am doing wrong ?





 
        dbbM01(mSymbol,mTFM01,mBBPeriod,mBBDeviationOut,mBBDeviationInn); // CAUSING ERROR ...

You are calling a constructor, not a function. You can only call a constructor in the owning class's constructor. Compare to:

CStrategyBase(string pSymbol,double pRiskPerTrade = 1.00) : CInputBase(pSymbol,pRiskPerTrade) { }
 
William Roeder #:

You are calling a constructor, not a function. You can only call a constructor in the owning class's constructor. Compare to:

Hi William

Your reply seems too much technical :), however when I tried creating at pointer variable *dbb and define dbb = new CiDBB(mSymbol,mTFM01,mBBPeriod,mBBDeviationOut,mBBDeviationInn); it worked.

Thanks for your time and efforts.

Reason: