OnDeinit in indicators - page 4

 
eevviill:
OK. Deinit doesn't do the zeroing either.

You still haven't answered the question, what do you mean by zeroing the buffers?

The client terminal does not zero the contents of the indicator buffers. Zeroing shall be provided by the programmer.

The buffers are cleared automatically when the indicator is unloaded

 
stringo:

You still haven't answered the question, what do you mean by zeroing the buffers?

The client terminal does not zero the contents of the indicator buffers. Zeroing shall be provided by the programmer.

Buffers are deleted automatically when loading an indicator

 ArrayInitialize(body_up,EMPTY_VALUE);
ArrayInitialize(body_down,EMPTY_VALUE);
ArrayInitialize(shadow_up,EMPTY_VALUE);
ArrayInitialize(shadow_down,EMPTY_VALUE);
  ArrayInitialize(yell_body_up,EMPTY_VALUE);
ArrayInitialize(yell_body_down,EMPTY_VALUE);
ArrayInitialize(yell_shadow_up,EMPTY_VALUE);
ArrayInitialize(yell_shadow_down,EMPTY_VALUE);
It doesn't work either ininit or deinit.
 
eevviill:
It doesn't work in either init or deinit.
Why do you need it in deinit? And why would a dynamic indicator array need to be initialised?
 
eevviill:
This does not work in either init or deinit.

Once again.

You should initialize the array only before total recalculation. And that's only if you fill the array selectively and not element by element

 
stringo:

One more time.

You only need to initialize the array before the total recalculation. And that's only if you fill the array selectively, not one element after another

eevviill:
This doesn't work in either init or deinit.

Why do you need it in deinit? And why would a dynamic indicator array need to be initialised?

Have you read the problem?

 
evillive:
Why do we need it in deinit? And why initialize the dynamic array of the indicator?

Because somewhere you have to. Inite says you can't.

Because only 0 bar is counted. After closing the terminal and opening it after a couple of candlesticks the 0 bar is calculated + one more bar with an offset for the time the terminal was closed.

 
stringo:

One more time.

You only need to initialise the array before total recalculation. And that's only if you fill the array selectively and not in a row element by element

Nice. I only fill in element 0.

If you don't understand the problem, I can describe it again.

 
eevviill:

Because somewhere you have to. Inite says you can't.

Because only 0 bar is counted. After closing the terminal and opening it after a couple of candlesticks, it turns out that 0 bar is calculated + another one with a shift by the time the terminal was closed.

Actually the zero bar has been correctly calculated, but then history was loaded. And a new zero bar has been calculated.
 
Vinin:
Actually the zero bar was calculated correctly, but then the history was loaded. And a new zero bar has been calculated.

Here. I do a buffer zeroing for this. Inite has already said you can't do that.

I want to deinit. But it doesn't work there either. Why?

 
I will try to explain again (on my fingers):
  1. The terminal started up X amount of time after the last start-up
  2. Initiated history download, which is missing (terminal was idle for X minutes)
  3. Call OnCalculate for the available history prevtime= last known history time, indicator buffer size N bars
  4. While the history is being downloaded from the server, a tick comes
  5. Called OnCalculate of the indicator, where Time[0] is a tick time, the indicator memorizes it as prevtime, the size of the indicator buffer is N+1 bars (between N and N+1 bars there is a gap in the history)
  6. After the history is downloaded, OnCalculate is called again, but this time there is no hole in the history, but prevtime has the same date as Time[0] - no new bar (respectively, no clearing of buffers in the indicator), buffer size of indicator N+X/Timeframe bars and IndBuffer[0] are not the same as in step 5
Reason: