How to Initialize Indicator in a Class !!!

 

Dear Forum Members

I am creating a Class for Candle Patterns, where in another Class CiMA is variable.

NEED help

1) is this is correct way of passing parameters of CiMA to CCandlePattern ?

2) how to rectify 'CiMA' - pointer to this function type is not supported yet ... highlighted in the code

Thanks in advance

NOTE: I have just realized that it could be an issue as the CiMA Indicator was not initialized !!!

//+----------------------------------------------------------------------------------------------------------+
//| CLASS: Module of Candle Patterns
//+----------------------------------------------------------------------------------------------------------+
class FxCCandlePattern
  {
private:
  //--- Variables for Parameters
    string              m_Symbol;
    ENUM_TIMEFRAMES     m_TimeFrame;
    int                 m_BarCount;
    int                 m_MAPeriod;
    int                 m_Shift;
    ENUM_MA_METHOD      m_MAAvgMethod;
    ENUM_APPLIED_PRICE  m_AppliedPrice;

protected:
  //--- methods, used for check of the candlestick pattern formation
    double            m_MA[];
    MqlRates          m_Rates[];
    bool              Get_MA(void);
    bool              Get_MqlRates(void);        // Gets history data of MqlRates structure
  //--- Class Instances and Indicators
    FxCiMA            CiMA(void);		// Class is defined with parametric constructor, so use of (void) is correct here ?
  //--- methods for Internal calculations
    double            candle_AvgBody(int index);
    double            candle_MidPoint(int index);
    double            candle_MidOpenClose(int index);
    double            candle_CloseAvg(int index);
  //--- methods for checking of candlestick patterns
    bool              bearish_ThreeBlackCrows(void);
    bool              bullish_ThreeWhiteSoldiers(void);
    bool              bearish_DarkCloudCover(void);
    bool              bullish_PiercingLine(void);
    bool              bullish_MorningDoji(void);
    bool              bearish_EveningDoji(void);
    bool              bearish_Engulfing(void);
    bool              bullish_Engulfing(void);
    bool              bearish_EveningStar(void);
    bool              bullish_MorningStar(void);
    bool              bullish_Hammer(void);
    bool              bearish_HangingMan(void);
    bool              bearish_Harami(void);
    bool              bullish_Harami(void);
    bool              bearish_MeetingLines(void);
    bool              bullish_MeetingLines(void);

public:
  //--- Parametric Constructor and Destructor
                      FxCCandlePattern(string pSymbol,ENUM_TIMEFRAMES pTimeFrame,int pMAPeriod);
                     ~FxCCandlePattern(void);
  //--- method for checking of a certain candlestick pattern
    bool              Check_CandlePattern(enum_CANDLE_PATTERNS CandlePattern);
  //--- methods for checking of bullish / bearish candlestick pattern
    bool              Check_AllBullish(void);
    bool              Check_AllBearish(void);
  }; // END Of creating CLASS 'FxCCandlePattern'
//+----------------------------------------------------------------------------------------------------------+
//| METHOD:       FxCCandlePattern()
//| APPLICATION:  'parametric constructor' method with parameters passed into the Class
//+----------------------------------------------------------------------------------------------------------+
FxCCandlePattern::FxCCandlePattern(string pSymbol,ENUM_TIMEFRAMES pTimeFrame,int pMAPeriod)
  {
    m_Symbol       = pSymbol;
    m_TimeFrame    = pTimeFrame;
    m_BarCount     = 10;
    m_MAPeriod     = pMAPeriod;
    m_Shift        = 0;
    m_MAAvgMethod  = MODE_SMA;
    m_AppliedPrice = PRICE_CLOSE;
    FxCiMA         CiMA(m_Symbol,m_TimeFrame,m_MAPeriod,m_Shift,m_MAAvgMethod,m_AppliedPrice); // Is this correct way to pass parameters to an Instance within another class ?
  } // END Of Constructor method()...
//+----------------------------------------------------------------------------------------------------------+
//| METHOD:       FxCCandlePattern()
//| APPLICATION:  'parametric constructor' method with parameters passed into the Class
//+----------------------------------------------------------------------------------------------------------+
FxCCandlePattern::~FxCCandlePattern(void)
  {
//---
  } // END Of Destructor method()...
//+----------------------------------------------------------------------------------------------------------+
//| METHOD:       Get_MA(void)
//| APPLICATION:  To get MA Prices
//+----------------------------------------------------------------------------------------------------------+
bool FxCCandlePattern::Get_MA(void)
  {
    ArrayResize(m_MA,m_BarCount);
    ArraySetAsSeries(m_MA,true);
    CiMA.Get_iMA(0,m_BarCount,m_MA);  // <-- "." open parenthesis required + pointer to this function type not supported yet + "." object required
  //---
    return(true);
  } // END Of Get_MA()
//+----------------------------------------------------------------------------------------------------------+
//| METHOD:       Get_MqlRates(void)
//| APPLICATION:  Gets history data of MqlRates structure of a specified symbol-period in specified quantity
//|               into the rates_array array.
//+----------------------------------------------------------------------------------------------------------+
bool FxCCandlePattern::Get_MqlRates(void)
  {
    ArrayResize(m_Rates,m_BarCount+1);
    ArraySetAsSeries(m_Rates,true);
    ResetLastError();
    int copied = CopyRates(m_Symbol,m_TimeFrame,0,m_BarCount,m_Rates);
    if(copied < 0)
      {
        Print(__FUNCTION__,": Error copying MqlRates Error Code ",GetLastError());
        return(false);
      }
  //---
    return(true);
  } // END Of Get_MA()