How to remove arrows of the same type following the first arrow? - page 2

 
Petr Nosek #:I may be wrong, but prev_calculated cannot be "scrolled back" (only to zero). It can be "paused" when a connection is lost (e.g.), and then resumed from the last calculated bar. In that case, resetting a static variable as Keith suggested would be sufficient.Or did I miss something?

Technically that is correct according to the documentation, but unfortunately it has happened to me twice. And on a third occasion it even grew larger than the previous value.

I have no ideia why it happened, but to be better safe than sorry, I decided to make all my indicator keep incremental track of states or counts.

To save space, I often use "union" to store multiple variables in a single buffer. Since buffers are "double", I can easily map the 8 bytes into multiple variables, like "bool", "uchar", "shortint" in a single buffer.

 
Fernando Carreiro #:

Technically that is correct according to the documentation, but unfortunately it has happened to me twice. And on a third occasion it even grew larger than the previous value.

I have no ideia why it happened, but to be better safe than sorry, I decided to make all my indicator keep incremental track of states or counts.

To save space, I often use "union" to store multiple variables in a single buffer. Since buffers are "double", I can easily map the 8 bytes into multiple variables, like "bool", "uchar", "shortint" in a single buffer.

Thanks for the clarification. I really appreciate your work on this forum. Your replies are very helpful and there is no arrogance in them like some other users' replies. However, if something like this can happen (prev_calculated can scroll backwards or forwards), it will be a problem for the buffer as well (same as for a static variable). In that case, the only option is really to watch the increments in our own way.

 
Petr Nosek #: However, if something like this can happen (prev_calculated can scroll backwards or forwards), it will be a problem for the buffer as well (same as for a static variable). In that case, the only option is really to watch the increments in our own way.

Yes, that is correct. I keep track of prev_calculated and rates_total values by using a two static variables of previous values.

When I detect discrepancies, I adjust accordingly and sometimes even do a complete refresh if the values are incoherent.

 
Petr Nosek #: Thanks for the clarification. I really appreciate your work on this forum. Your replies are very helpful and there is no arrogance in them like some other users' replies.

You are welcome and I thank you for the complement! I truely appreciate it!

 
Fernando Carreiro #:

Please, first attempt to code what has been explained already — namely, add the extra buffer for tracking the current trend.

Then provide complete code that compiles, that includes the indicator properties and declarations of global variables, including the buffers.

Thank you for your help. I am doing it. Seems the hardest thing for me is coding, I'm just an amateur. I will update the results later.