I can use CiMA in experts but not use it in indicator ,why? New comment stangstang 2011.05.05 15:02 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 : 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: why make the different result ? who can tell you ,thank you very much! OOP and Indicators Angle indicator keeps returning 0.000 error take profit price using custom indicator New comment
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 :
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:
why make the different result ? who can tell you ,thank you very much!