CIndicators* indicators

 

hi I am new to EA writing using standard library and have some questions:

1. I looked at some code and saw that for creating signals from some indicators they act like this:

bool CSampleSignal::InitIndicators(CIndicators* indicators)
  {
//--- Validation of the pointer
   if(indicators==NULL)       return(false);
//--- Initialization of the moving average
   if(!InitMA(indicators))    return(false);
//--- Initialization of the timeseries of open prices
   if(!InitOpen(indicators))  return(false);
//--- Initialization of the timeseries of close prices
   if(!InitClose(indicators)) return(false);
//--- Successful completion
   return(true);
  }
bool CSampleSignal::InitMA(CIndicators* indicators)
  {
//--- Initialization of the MA object
   if(!m_MA.Create(m_symbol.Name(),m_period,m_period_ma,m_shift_ma,m_method_ma,m_applied_ma))
     {
      printf(__FUNCTION__+": object initialization error");
      return(false);
     }
   m_MA.BufferResize(3+m_shift_ma);
//--- Adding an object to the collection
   if(!indicators.Add(GetPointer(m_MA)))
     {
      printf(__FUNCTION__+": object adding error");
      return(false);
     }
//--- Successful completion
   return(true);
  }

 my question is about indicators variable why every indicator that created add to this variable and not used this variable anymore?

whats the reason?

2. in  the line  if(indicators==NULL)       return(false); 

we still not created the pointer but check validation whats the point? 

 
pumper:

hi I am new to EA writing using standard library and have some questions:

1. I looked at some code and saw that for creating signals from some indicators they act like this:

 my question is about indicators variable why every indicator that created add to this variable and not used this variable anymore?

whats the reason?

2. in  the line  if(indicators==NULL)       return(false); 

we still not created the pointer but check validation whats the point? 

It seems nobody else know this
Reason: