Discussion about OnCalculate returning 0. - page 4

 
Vladislav Boyko #:

Most likely, you simply removed the indicator from the chart (this was the reason for REASON_REMOVE).

I didn't. I'm not here to waste anyone's time. I post my honest findings. As said, return 0 brought about this REMOVE code. 

I find it hard to believe that it would be any different for you or anyone else. You should double check that, have you printed the reason code in OnDeInit?
 
Alain Verleyen #:

No. Returning 0 will just lead to the next OnCalculate call using prev_calculated=0.

Please provide code to show your issue if you need more explanation.

This is completely wrong.

Edit by Alain as moderator : we can't allow people to post wrong statement without any proof of their claim. Moreover when he just refused several times to post the code he used.

 
Vladislav Boyko #:

I thought the return value didn't affect anything at all except prev_calculated.

But, it turned out that the terminal does not update the indicator when the indicator returns 0. In this context, you are right - it is better not to return 0.

That's right but it doesn't make any sense to always return 0 . You need to return 0 when there is a reason to do so (when a full update is needed), otherwise return rates_total and it's working perfectly fine.

And it has nothing to do with Conor claim anyway.

But returning 0 does not lead to a crash or deinitialization - in this context, you are wrong (at least I cannot reproduce it).

Of course.

The case is closed (unless something really new would be posted).

 

The issue discussed in this topic, where it happens the indicator is running OnDeinit() with a reason = REASON_REMOVE (1) on a timeframe change, is related to some recent change (or is it a bug ?) on MT5 behaviour. As possibly reported in these topics :

It's absolutely not related to the value returned in OnCalculate(). It's the merit of @Conor Mcnamara to have noticed the problem, though his conclusion was wrong. A correlation of events is not a causality.