buitiful!!!
also with casting to CiCustom I couldn't manage:
(CiCustom)Ind.NumBuffers(1) ==> wrong parameter count
Any comment from the team?
Thanks
- www.mql5.com
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
This is the code inside a script
CIndicator *ind;
ind = new CiCustom;
ind.NumBuffers(1); // <== compiler error: wrong parameter count - I also tried ==> ((CiCustom)ind).NumBuffers(1); // <=== invalid cust operation
if(ind.Create(NULL,PERIOD_CURRENT,IND_CUSTOM,8,parms)){
Print("successful ind creation");
}
else
Print("failed ind creation");
and then passing the ind pointer on to a different class and in that class:
CIndicator *ind;
switch (ind.Type()){ === > compiler error: type is not declared for CIndicator as virtual
case IND_CUSTOM:
parms = ind.NumParams(); ====> always zero -> m_num_params inside CiCustom is zero, it was not initialized by the Initialize method of CiCustom
}
the ind.Create in third line, runs the Initialize method of CiCustom in the background but the method does not initializes the m_num_params, so on the other class when I use the method ind.NumParams() and get zero, even though the ind.Create was successful and the Initialize method ran.
P.S:
Please look inside the code of the CiCustom.mqh and you will notice that there is no initialization of m_num_params anywhere in the code.
And so, the method NumParams() that is defined: int NumParams() { return(m_num_params); } // <============= always return zero
Anyone? Rosh?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I can't get it right when using the CIndicator and the inherited classes.
If I declare a CIndicator pointer, and then use it as an inherited CiCustom, I can't manage to make it.
CIndicator *ind;
Ind = new CiCustom;
and when using a method from CiCustom, NumBuffers, in order to set the number of the buffers I get error message: 'NumBuffers' - wrong parameter count.
Ind.NumBuffers(1) ==> wrong parameter count
because probably NumBuffers of the CiCustom that sets the buffers is not recognised. What am I doing wrong?
and also then when I try to inspect the Ind variable in order to see what type of CIndicator inherit is it (CiCustom or others)
how do I do it? Because I can't get it with:
switch (Ind.Type())
case IND_CUSTOM:
....
because Type() is not declared in the CIndicator, only in it's inheritors.
The reason that I need to know at run time the type of the indicator, is that if it is custom indicator I want to be able to get the Indicator parameters thru the methods in CiCustom.
BUG ** - the initialize method in CiCustom does not initializes m_num_params
thank you