I wrote an Indicator which works just fine. It has 5 Buffers in total, which are all working fine (i checked in the data-window when applied to a chart and they contain values where they should).
Now i created an EA wich reads this indicators buffers. I can read the first 3 Buffers (SetIndexBuffer0 to 2) but if i try to read the values of buffer 4 and 5 (SetIndexBuffer3 and 4) it returns 0 at any time. There are no obvious differences in the definition of the buffers.
i also already tried to change the order of the buffers , but nothing changed (i was able to retrive data from the last buffer, but the other 2 still returned 0)
i checked this by backtesting the EA and let it print the value of the needed buffers on every tick --> always 0
does anyone have an idea where to look for the mistake?
thank you very much,
Thanks for your reply.
I made a change in the indicator to change the values and the EA saw the changes. So the "version" of the indicator should be correct
i didn't want to include the indicator into the EA and thought it would be better to let the EA do the money management and the indicator the trade signal. This would result in clearer scripts, wouldn't it? Or is there a more elegant way to include the lodic of the indicator into the EA?
I noticed that calls to iCustom slow down the backtest significantly. So this is why I moved my indicator logic into a class that I could call from both the indicator and the EA. The indicator class has an OnTick that receives tick and time values and it has some public members like MainCurrent, SignalCurrent, MainPrevious, IsUpCross etc that can be read out.
Regarding the other issue I think you need to show the indicator and the lines of code from your EA which fetch the values.