Strange behavior of indicators / Redraw an indicator?

 

Hi,

I've experienced a really strange thing with some self-written indicators.

I ran MT Client for 1 or 2 days live and found that my indicators show wrong values. So I double-clicked the indicator and the settings-menu popped up. I just checked the variables but DID NOT change any values there, just clicked OK and then the indicator was repainted. Suddenly the indicator showed totally different values (the correct ones!).

Sometimes the differences are small, sometimes really big.

I've already added WindowRedraw() in start() - seemed like it had no effect.

Thanks in advance

 

See article Tester in the Terminal MetaTrader 4: It Should Be Known



Why are the indicator values in testing and the indicator values in the on-line chart are not equal?

One of the mistakes during indicator writing is an incorrect calculation of the indicator values and paralogism. As a result, the indicator starts "lying" and collecting mistakes. In other words, yesterday the indicator showed values, different from today's ones in the same period.

The mistake of such indicators can be also seen in the on-line operation of the indicator. For example, we attach the indicator to a 15-minute chart, wait for the appearance of 3-4 new bars and then attach one more such indicator, but using other colors. The difference is very often seen visually. Here is an example of such an incorrect indicator:



Important: indicators are calculated in the course of testing, like during the online operation, that is why all mistakes in the indicator's logic become apparent in the process of testing!

 

Hi Rosh,

thanks four your hint! Haven't yet completely figured out the cause, but I'm on it.

I already found out that it has to do with the IndicatorCounted-function. I think I'll get it done. Thanks!

Reason: