Topic: Array out of range error in exported MQ4 EA
Hello!
At first - great progress with FSB! Its functionality, even in free mode - very impressive!
But I faced with an issue - I exported FSB strategy to MQ4, but when I'm trying to attach it to the MetaTrader chart - it writes "Array out of range" in expert's log and disappears from chart.
Line and position numbers points to the method "void HMA::Calculate(DataSet &dataSet)", line "Component[1].Value[bar]=tempVal;". Error occurs accessing "Value[bar]".
I've inserted some debug lines before this line, and here are some details:
- Accessing Component[1], ArraySize(Component)=10
- Assigning Component[1].Value[4], ArraySize(Component[1].Value)=0
I found that there are two lines in the original HMA.cs:
Component = new IndicatorComp[2];
Component[1] = new IndicatorComp {Value = new double[Bars]};
but there is nothing similar/corresponding in generated MQ4.
Any idea - how to fix this?
In general - generated MQ4 doesn't look as one-to-one replica of initial CS, so I'm afraid to make manual changes to MQ4.