2. parameters_array should be const
Now (MetaEditor 5.00 build 247), if I give IndicatorCreate() a const MqlParam array as parameter,
It will cause compile error:
'cIndiParamALLIGATOR' - parameter conversion is not allowed testAlligator.mq5 94 52
So I must make a function to copy the const MqlParam array to a non-const array.
It make an unnecessary move.
const MqlParam cIndiParamALLIGATOR[8] = { { TYPE_INT,13, 0.0, ""},
{ TYPE_INT, 8, 0.0, ""},
{ TYPE_INT, 8, 0.0, ""},
{ TYPE_INT, 5, 0.0, ""},
{ TYPE_INT, 5, 0.0, ""},
{ TYPE_INT, 3, 0.0, ""},
{ TYPE_INT, MODE_SMMA, 0.0, ""},
{ TYPE_INT, PRICE_MEDIAN, 0.0, ""} };
MqlParam m_IndiParam[8];
bool CopyMqlParam(const int iNum, const MqlParam& rcaParam[])
{
if (iNum<=0)
return(true);
for(int i=0;i<iNum;i++)
{
m_IndiParam[i].type = rcaParam[i].type;
m_IndiParam[i].integer_value = rcaParam[i].integer_value;
m_IndiParam[i].double_value = rcaParam[i].double_value;
m_IndiParam[i].string_value = rcaParam[i].string_value;
}
return(true);
}
void OnInit()
{
...
CopyMqlParam(8, cIndiParamALLIGATOR);
m_handle=IndicatorCreate(NULL,0,IND_ALLIGATOR,8,m_IndiParam);
...
}
3. CopyBuffer() lost last value when get m_handle from
iAlligator() and IndicatorCreate(NULL,0,IND_ALLIGATOR,8,m_IndiParam)
4. And iGator(), I think it should fill all the data buffer, do not let user patch in indicator.
4.----Perhaps I misunderstood. Forget it. Unless you have other ideas.
3. I add set empty value and ArrayInitialize()
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);
PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0);
ArrayInitialize(ExtJaws,0.0);
ArrayInitialize(ExtTeeth,0.0);
ArrayInitialize(ExtLips,0.0);
But it still can not be drawn shift.
And it happen strange phenomena.
I just compiled it, did not do anything else.
1. Documentation will be fixed
2. You are right, parameters_array should be const, implementation fixed.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
1. do not support "[]&" grammar
In MQL5 Reference / Timeseries and Indicators Access / IndicatorCreate,
there is:
But when I write
It cause compile error:
I must write
So, please change the MQL5 implementation or document.