Error 4806 on closed market (with no new ticks) - page 3

 

This is MTF RSI Smoothed https://www.mql5.com/en/code/2186

Now market closed, it can not work on other timeframe ( like attach on M30 and set RSI on H1 )


MTF RSI Smoothed (recursive)
MTF RSI Smoothed (recursive)
  • votes: 20
  • 2014.01.16
  • Andrey Voytenko
  • www.mql5.com
Recursive implementation of multi-timeframe smoothed RSI indicator.
 

I have the same problem.

But I noticed it works on the second try - if you get error 4806 then do not return 'rates_total' on OnCalculate(), but instead return 0. It will make the MT5 to call OnCalculate again, and on second time it works. 

 
Karlis Balcers:

I have the same problem.

But I noticed it works on the second try - if you get error 4806 then do not return 'rates_total' on OnCalculate(), but instead return 0. It will make the MT5 to call OnCalculate again, and on second time it works. 

If I understand well, you mean that if you get error 4806 you can try to force the mt5 to call again the "OnCalculate()" .

Is there any way to force this by code?

I tried, when I got the error 4806 in the CopyBuffer, to call again the OnCalculate, something like this:

if (CopyBuffer(handle,0,TIME[0],1,Buffer) <0) {  OnCalculate(rates_total,prev_calculated,time,open,high,low,close,tick_volume,volume,spread);  }

Doing so, the paltform shows the indicator, but immediatly it fails with "Stack overflow".

 

I meet the same problem. And the source code for the indicator is attached....Hope you can help me  tackle it. Many thanks....

BarsCalculated() return with error code 4806.
BarsCalculated() return with error code 4806.
  • 2019.02.03
  • www.mql5.com
I use the indicator attached to show a H4 moving average in H1 Chart.[by setting the period parameter to H4 in a H1 chart...
 
tao zemin.:

I meet the same problem. And the source code for the indicator is attached....Hope you can help me  tackle it. Many thanks....

That is because you do not have enough Bars data to build the other timeframes.

Put the chart on M1, it will download the necessary data to build Bars for other timeframes and it will work. 

 

Hi,

i have same problem! It is a mess this bug was NOT solved after 7 years!!!

 
Karlis Balcers:

I have the same problem.

But I noticed it works on the second try - if you get error 4806 then do not return 'rates_total' on OnCalculate(), but instead return 0. It will make the MT5 to call OnCalculate again, and on second time it works. 

Hi!

I was searching the forum to find a problem for the exact same problem: I got this error while working in developing an indicator that calls 3 other indicators each of each connected to a different time frame (1, 5 and 15 min in my tests), testings done when market is offline (saturday now). I'ld like to tell that your solution managed to solve my problem, so thanks! =)

 
I fix my problem with:
if (BarsCalculated(handlerMtf) < 0)
{
	PrintFormat("Data not found (Timeframe :: %s-%d) >>", EnumToString(timeframe), GetLastError());
	ChartSetSymbolPeriod(0, NULL, 0);
	return 0;
}
Reason: