Anyone knows why I cannot use the structure below @OnInit() since it works perfectly on OnTick() ?
The idea is to check handle management BEFORE receiving the 1st tick and realise it will not work due to lack of history.
Print("Failed to copy data from the indicator buffer or price chart buffer: ",GetLastError());
Thank you and Regards,
When I place this structure @ the end of OnInit(), CopyBuffer as an integer function returns -1ERR_INDICATOR_DATA_NOT_FOUND/ 4806/ Requested data not found
When I place the exact same structure @ the OnTick(), CopyBuffer as an integer function returns 6
When I place this structure @ the end of OnInit(), CopyBuffer as an integer function returns -1
-1 means there is an error, what is the error code ?
Have you tried a while?
Your indicator is not yet ready.
Seems a lot of Brazilian people are trying to use CopyBuffer() in OnInit().
Sorry, of course it's supposed to add a counter to avoid an endless loop. (Coutinho is an experienced programmer, he would realize that).
My point is that the problem may not be that the data is not available at all, but just not available yet and a loop will solve that.
PS: Never tried and CopyBuffer in OnInit, it's just and idea.