Thank you for the article.
I have one question. You use the first form of the indicator to optimise indicator calculations, there is begin. But if you can not use it (for correct calculations need open[], high[], low[], close[] ...) how to be? There is no begin in the second form.
Thank you for the article.
I have one question. You use the first form of the indicator to optimise indicator calculations, there is begin. But if you can't use it (for correct calculations you need open[], high[], low[], close[] ...) how to be? There is no begin in the second form.
not everything is considered, but in general it is still interesting =)
and specifically such a thing as optimisation of technical indicators call is not considered.
I think this topic is quite relevant.
more precisely, how to initialise the technical indicator better
in general the function of data checking is implemented
but the example of initialisation is not exactly considered
as far as it is known from the help
Нельзя обратиться к данным индикатора сразу после его создания, так как на расчет значений индикатора требуется некоторое время, и поэтому создавать хэндлы индикаторов лучше всего в OnInit(). Функция iCustom() создает соответствующий пользовательский индикатор и при успешном создании возвращает его хэндл. Пользовательские индикаторы могут содержать до 512 индикаторных буферов, содержимое которых также можно получать при помощи функции CopyBuffer(), используя полученный хэндл.
how best to bypass this feature....
I'm always wondering the same thing.
if (Handle == INVALID_HANDLE) Print(" Failed to get SMA indicator handle");
if this condition works, what do I do? Let's say it's the championship, that's it... init won't run anymore.
I've been wondering the same thing all along.
if this condition works, what do I do? Let's say it's the championship, that's it... the init won't run anymore.
Yes! It's an undocumented fact, I didn't know that either! We should definitely look into it! But it's easier for me, I'll pack all the turkeys into the Expert Advisor itself and that's it, so that the Expert Advisor runs like a sprinter on marathon distances and doesn't stumble anywhere and never!
I'm always wondering the same thing.
If this condition works, what should I do? Let's say it's a championship, that's it ... the init won't run anymore.

- www.mql5.com
First of all, get the error code and output it to the log. And try to access it again in OnTick() or OnCalculate(). If you fail to get the indicator handle, most likely there is no such indicator or it lacks memory. In this case, the Expert Advisor has no right to trade.
Well, here we are! We can do it ourselves! In such a situation, if we could make the OnInit() function return minus one to call OnInit() again and so on until the handle appears! But now it's clear that if you don't overstress your computer, there will be no reason for not getting the handle. But I've seen this once when updating a build, it can be cured by recompiling the indicator!

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article The Principles of Economic Calculation of Indicators is published:
Calls to user and technical indicators takes up very little space in the program code of automated trading systems. Often it’s simply a few code lines. But it often happens that it is these few lines of code which use up the largest portion of time, which needs to be spent on testing the Expert Advisor. Therefore, everything that is related to data calculations within an indicator, needs to be considered much more thoroughly than would seem at first glance. This article will talk precisely about this.
Author: Nikolay Kositsin