OnDeinit in indicators - page 3

 

Do a Print at the beginning of OnDeinit and after closing the client terminal, look at the Expert log and make sure that OnDeinit has been called!

Here is your error

for(int i=ObjectsTotal()-1;i>=0;i--)

You clearly know the objects you have created yourself.

Keep their names and delete them without reference to ObjectsTotal and ObjectName

PS the new build has added a function to delete a group of objects by prefix. It will help you if you name your objects using the same unique prefix in their name

 
stringo:

Do Print at the beginning of OnDeinit and after closing the client terminal, look at the EA log and make sure that OnDeinit was called!

Here is your mistake

You clearly know the objects you created yourself.

Save their names and delete them without reference to ObjectsTotal and ObjectName

PS The new build has added a function to delete a group of objects by prefix. It will help you if you name your objects using the same unique prefix in their name

I've already had a chance to test how deleting a group of objects by prefix works. Great, but even the compiled code in previous builds doesn't work. Consequently, it can be used, for now, only for personal purposes. We don't have to force the users to update because of it. Many don't even know how to update until they upload the update to the DC server.
 
stringo:

Actually, deinit in all programs is called when the terminal is closed.

There is even a special code for the cause of deinitialisation. REASON_CLOSE

And does it reset indicator buffers or not?
 
eevviill:
And does it reset the indicator buffers or not?
What is "resetting the indicator buffers"?
 
eevviill:
And does it reset the indicator buffers or not?
Everything is reset. After all, the terminal closes )))
 
stringo:

The situation with your indicator has been solved.

Here's the thing - the indicator is calculated not only on the ticks arrival, but also on the first drawing and on the missing history arrival.

1. A new tick arrives - the indicator is calculated.

2. The missing history arrives, which plugs the hole between the last data from the last terminal start and the last tick. The indicator is calculated. But at the same time there is no new bar condition!

To solve this problem you need to check the number of bars. Approximately like this

Hmm. Put EMPTY_VALUE buffer initialization block in Inite. The problem remains.
 

Stuck the buffer initialisation block with an empty value in both init and deinit. The result is the same. I.e. it does not exist.

Waiting for developers comments.

 
Scriptong:
Everything resets to zero. After all, the terminal closes )))
Yeah yeah.
 
eevviill:
Hmm. The buffer initialization block EMPTY_VALUE is put in Inite.

Why? Inite buffers may not yet be allocated.

What about when the buffer is heavily buffered (a new batch of historical data has arrived)?

In such cases, the initialization of the buffers is done before the indicator calculation, when it's clear that the whole indicator will be recalculated

 
stringo:

Why? Inite buffers may not yet be allocated.

And what about when the buffer is very big (a new batch of historical data came)?

In such cases, initialization of buffers is done before the calculation of the indicator, when it is clear that the entire indicator will be recalculated

ok. Zeroing does not work in deinit either.