prev_calculated - page 7

 
Alexander Puzanov:

You have a faulty judgement on all three points.

prev_calculate displays the number of BARs counted (processed) on the previous call. This is an axiom.

If history has changed, swollen, or the indicator has not been calculated yet - value of prev_calculate==0. This is also an axiom.

What part of this is not clear?

 
Karputov Vladimir:

You have a faulty judgement on all three points.

prev_calculate displays the number of BARs counted (processed) on the previous call. This is an axiom.

If history has changed, swollen, or the indicator has not been calculated yet - value of prev_calculate==0. This is also an axiom.

What part of this is not clear?

Only two problems are not clear from it:

1. Where does the history disappear if neither the terminal nor the chart was closed?

2. Is it so hard to make the array without space rubbish when initializing the indicator buffer? Or the array is initialized with the value set in PLOT_EMPTY_VALUE

 
Alexey Viktorov:

Only two problems are not clear from this:

1. Where does the history disappear if neither the terminal nor the chart has been closed?

2. Is it so hard to make an array without space rubbish during indicator buffer initialization? Or the array should be initialized with the value set by PLOT_EMPTY_VALUE

1. @Where does history disappear if neither the terminal nor the chart was closed?

2. This is quite a real life situation, encountered at every step. I need to declare a variable. Which do you think is right, a) or b):

a): int i;
б): int i=0;
 
Karputov Vladimir:

1. @Where does the history disappear if neither the terminal nor the chart was closed?

2. This is quite a real-life situation, encountered at every step. I need to declare a variable. Which option do you think is right, a) or b):

a): int i;
б): int i=0;

1. No implication, straightforward question. The terminal is working, quotes are received, at every tick the indicator recalculates OnCalculate and counts prev_calculated that returns rates_total and suddenly bang!!! and a whole bar is lost... Where to???

2. Do not lump variables, custom arrays and indicator buffers together.


It looks like a crutch has been found. The indicator is launched with this crutch. After another loss of history there will be a result.

 
Alexey Viktorov:

Only two problems are not clear from this:

1. Where does the history disappear if neither the terminal nor the chart has been closed?

2. Is it so hard to make the array without space rubbish when initializing the indicator buffer? Or the array is initialized with the value set in PLOT_EMPTY_VALUE

2. Not difficult, but unnecessary, even undesirable. Because the buffers are filled with the calculated indicator data. There is no need to do unnecessary.
 
Karputov Vladimir:

You have a faulty judgement on all three points.

prev_calculate displays the number of BARs counted (processed) on the previous call. This is an axiom.

If history has changed, swollen, or the indicator has not been calculated yet - value of prev_calculate==0. This is also an axiom.

What part of it is not clear?

Oh dear, how do you think the bug is different from the axiom? You do not need to put words in your head here - all of the formulated in 3 points can be easily seen in my 1st post. If it is not so - you are a programmer, not a carpenter, show in your code how to solve separately simple tasks listed in 3 paragraphs with bare prev_calculated without additional crutches: show how many bars were counted on the previous tick, define first call of OnCalculate and define that the history (checksum) has been changed. There is no need to make anything up for the user, to fit your axioms - the tasks are formulated, very simple and unambiguous as half a finger

 

Alexey Viktorov:

This is NOT in the documentation!!! Hence, it is a free-wheeling essay. Just like my statement about automatic initialisation, even cooler. At least mine had a disclaimer...

What are you talking nonsense about? If this initialization is implemented in OnCalculate, it will be initialized without any loops. But if prev_calculated is zeroed, it resets all data that have been accumulated during operation...

To a question about initialization of buffers at initialization. Consider logically. There is no access to rates_total in OnInit(), right? If there is no access to rates_total in OnInit(), then the sizes of indicator buffers are not known yet ( =0 you can check yourself ). And since an indicator buffer size = 0, what are you going to reset?

 
Alexander Puzanov:

Oh dear, how do you think a bug is different from an axiom? There is no need to sprinkle your brains with words here - all formulated in 3 paragraphs can be easily seen in my 1st post. If it is not so - you are a programmer, not a carpenter, show in your code how to solve separately simple tasks listed in 3 paragraphs with bare prev_calculated without additional crutches: show how many bars were counted on the previous tick, define first call of OnCalculate and define that the history (checksum) has been changed. There is no need to make anything up for the user, to fit your axioms - the tasks are formulated, very simple and unambiguous as half a finger

You should not address this question to Vladimir (he only defends the developers' position), but to the developers themselves, who (represented by Slawa) told you that when prev_calculated = 0, everything must be recalculated. They cannot always calculate all variants of the indicator use. If there is a problem now, there is no use torturing the moderator, you have to go to servicedesk with a detailed description.
 
Alexey Viktorov:

Is it so hard to make sure that there is no space junk in the array when initializing the indicator buffer? Or the array is initialized with the value set to PLOT_EMPTY_VALUE

if (rates_total > prev_calculated)
  ArrayFill(Buffer, prev_calculated, rates_total - prev_calculated, EMPTY_VALUE);
 
Alexey Viktorov:

1. No subtext, straightforward question. Terminal works, quotes are received, at every tick the indicator recalculates OnCalculate and counts prev_calculated returning rates_total and suddenly bang!!! and a whole bar is lost... Where to???

2. Do not lump variables, custom arrays and indicator buffers into one pile.


It seems that a crutch has been found. The indicator is launched with this crutch. After another loss of history there will be a result.

1. Again a train of thought, but I still haven't seen the point.

2. You still haven't answered your question, which tells me that you have never thought about what is stored in the variable after it is declared.