Andrey Khatimlianskii:Try printing prev_calculated at the very beginning of OnCalculate. And compare it to some standard indicator - is it flashing.
Added two static variables to OnCalculate() function to compare current values with previous values:
static int last_rates_total=0; // previous value "input timeseries size at previous static int last_prev_calculated=0; // previous value "bars processed at the previous call
and verification code with the output to the journal
//+------------------------------------------------------------------+//| Custom indicator iteration function//+------------------------------------------------------------------+intOnCalculate (constint rates_total, // размер входных таймсерий constint prev_calculated, // обработано баров на предыдущем вызове
...
{
int N=rates_total-prev_calculated; if (N>MAX_PERIOD) N-=MAX_PERIOD;
staticint last_rates_total=0; // размер входных таймсерий staticint last_prev_calculated=0; // обработано баров на предыдущем вызове if (rates_total!=last_rates_total || prev_calculated!=last_prev_calculated) {
Print("N=", N, ", rates_total=", rates_total, ", prev_calculated=", prev_calculated);
last_rates_total=rates_total; last_prev_calculated=prev_calculated;
}
for (int i=N; i>0 && !IsStopped(); i--) {
...
}
aUP[0]=EMPTY_VALUE; aDN[0]=EMPTY_VALUE;
return(rates_total);
}
Started the AOM indicator on the minute and got this report
Andrey Khatimlianskii: Are the indicators from the standard delivery blinking?
No, I put a couple of standard indicators "Moving Average", "Awesome Oscillator" on the chart. Observed. No, I did not notice any flickering or disappearing values in"Data Window".
No, I put a couple of standard indicators "Moving Average", "Awesome Oscillator" on the chart. Observed. No, I did not notice any flickering or disappearance of values in"Data Window".
I mean those indicators that are in the source (mq5).
If they do not blink, then the problem is obviously in your code. Simplify it until it stops flickering. Or vice versa - refine the standard code to your state, until it flickers.
Andrey Khatimlianskii: I mean those indicators which are in the source code (mq5). If they do not blink, then the problem is obviously in your code. Simplify it until it stops flickering. Or vice versa - refine the standard code to your state, until it flickers.
But I've already simplified the code to the point of flicker. Ok, I'll try to go the opposite way.
By the way, I haven't found a universal "wrapper" for OnCalculate() function, even among standard indicators, to use it once and for all. Maybe, you know some indicator that has such a "wrapper" to use it as a reference?
Eugene Myzrov: But I've already simplified the code to the extreme. Ok, I'll try to go in other way.
It may be about any little thing.
Eugene Myzrov:
By the way, I have not yet found a universal "wrapper" for the OnCalculate() function, even among the standard indicators, to use it once and for all. Maybe, you may suggest an indicator which has such a "wrapper" to use it as a reference?
I have seen several variants. You may search and choose. I use this one myself:
//---if ( rates_total < MinBars ) return(0);
//--- last counted bar will be recountedint limit=rates_total-prev_calculated-1;
if(prev_calculated>0) limit++;
//---for( int i=limit; i>=0; i--)
{
IndBuffer[i] = Add your code here
}
//---return(rates_total);
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Try printing prev_calculated at the very beginning of OnCalculate.
And compare with some standard indicator - whether it flashes.
static int last_rates_total=0; // previous value "input timeseries size at previous
static int last_prev_calculated=0; // previous value "bars processed at the previous call
and verification code with the output to the journal
Started the AOM indicator on the minute and got this report
Nothing unexpected, normal processing of only new bars coming in is going on.
Added two static variables to OnCalculate() function to compare current values with previous values:
Nothing unexpected, there is a normal process of handling only new bars coming in.
No, I put a couple of standard indicators "Moving Average", "Awesome Oscillator" on the chart. Observed. No, I did not notice any flickering or disappearing values in"Data Window".
No, I put a couple of standard indicators "Moving Average", "Awesome Oscillator" on the chart. Observed. No, I did not notice any flickering or disappearance of values in"Data Window".
I mean those indicators that are in the source (mq5).
If they do not blink, then the problem is obviously in your code. Simplify it until it stops flickering. Or vice versa - refine the standard code to your state, until it flickers.
So you have to accept it, take it for granted and stop looking for the cause?
By the way, I haven't found a universal "wrapper" for OnCalculate() function, even among standard indicators, to use it once and for all.
Maybe, you know some indicator that has such a "wrapper" to use it as a reference?
So you have to accept it, take it for granted and stop looking for a reason?
But I've already simplified the code to the extreme. Ok, I'll try to go in other way.
It may be about any little thing.
By the way, I have not yet found a universal "wrapper" for the OnCalculate() function, even among the standard indicators, to use it once and for all.
Maybe, you may suggest an indicator which has such a "wrapper" to use it as a reference?
I have seen several variants. You may search and choose.
I use this one myself: