I suggest you don't do that. That is not the purpose of the OnInit event handler and there is no guarantee there will be data available at the time, and you should not be holding up the initialisation procedure.
Instead, process it on the first tick, in one of the other event handlers, after all the data has finished loading correctly.
Please always use the CODE button (Alt-S) when inserting code.
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
I suggest you don't do that. That is not the purpose of the OnInit event handler and there is no guarantee there will be data available at the time, and you should not be holding up the initialisation procedure.
Instead, process it on the first tick, in one of the other event handlers, after all the data has finished loading correctly.

- 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 want to do some analysis of the data within the Oninit() function before entering the execution. The data I want to analyze are the ones of an indicator and for this reason I am using the CopyBuffer function:
Whereas everything is working perfectly when I attach the EA at the live chart, I am facing a problem when testing the EA on the strategy tester: the buffer is just filled with 0 (and not with the indicator values).
Any suggestion?