I can use CiMA in experts but not use it in indicator ,why?

 

i  write such code in experts , it can work !

#include <Indicators\Trend.mqh>

CiMA  *ma;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   ma=new CiMA;
   ma.Create(Symbol(),PERIOD_CURRENT,20,0,MODE_EMA,PRICE_CLOSE);
   ma.Refresh(-1);
   Alert(ma.Main(0));
   return(0);

 

the successed result is :

result in expert 

 

but ,the same code is used in indicator that are create by me !,it can not work !

 #include <Indicators\Trend.mqh>
CiMA  *ma;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   ma=new CiMA;
   ma.Create(Symbol(),PERIOD_CURRENT,20,0,MODE_EMA,PRICE_CLOSE);
   ma.Refresh(-1);
   Alert(ma.Main(0));
   return(0);
}

the result is  not right , please see:

result in indicator that is create by me

why make the different result ?  who can tell you ,thank you very much!