Error 4806 on closed market (with no new ticks)

 

Hello,

my MTF (multi-timeframe) indicator works fine on opened market (when new ticks are received -> starting OnCalculate() function).

E.g.: I see D1 moving average values on 10min chart...


Problem is on the closed market where no new ticks are received. I get error 4806 (BarsCalculated function returns 0).

If I change chart period to D1 it works fine. It seems like OnCalculate() function in called indicator.ex5 is not started without new tick on different time-frame from D1?


Here is summary how I call the D1 indicator in my MTF indicator:

handle=iCustom(NULL,PERIOD_D1,"indicator.ex5",parameter);
.
.
.
calculated=BarsCalculated(handle);  //returns 0 on closed market with time-frame different from D1 !!!

Peter

Documentation on MQL5: Language Basics / Functions / Event Handling Functions
Documentation on MQL5: Language Basics / Functions / Event Handling Functions
  • www.mql5.com
Language Basics / Functions / Event Handling Functions - Documentation on MQL5
 
P_Cherry:

Hello,

my MTF (multi-timeframe) indicator works fine on opened market (when new ticks are received -> starting OnCalculate() function).

E.g.: I see D1 moving average values on 10min chart...


Problem is on the closed market where no new ticks are received. I get error 4806 (BarsCalculated function returns 0).

If I change chart period to D1 it works fine. It seems like OnCalculate() function in called indicator.ex5 is not started without new tick on different time-frame from D1?


Here is summary how I call the D1 indicator in my MTF indicator:

Peter

Did you checked your handle is valid ?

What is the returned value of OnCalculate() for indicator.ex5 ?

ERR_INDICATOR_DATA_NOT_FOUND

4806

Requested data not found

I don't when this error eccours, but if you get this error then handle it in your code (best way is to simply return).

 
angevoyageur:

Did you checked your handle is valid ?

What is the returned value of OnCalculate() for indicator.ex5 ?

ERR_INDICATOR_DATA_NOT_FOUND

4806

Requested data not found

I don't when this error eccours, but if you get this error then handle it in your code (best way is to simply return).

I printed handles and both (handle in MTFindicator.ex5 and handle in indicator.ex5) return 10.

OnCalculate() in indicator.ex5 returns 2450 (D1 rates total) even on closed market.

OnCalculate() in MTFindicator.ex5 returns nothing on closed market, due to the mentioned error 4806. After the new tick is received it returns 24500 (M20 rates total).

Is It not possible to get values from indicator.ex5 on different time-frame without tick update? Or do I need to use OnTimer somehow?

Thnaks

Peter

 
P_Cherry:

I printed handles and both (handle in MTFindicator.ex5 and handle in indicator.ex5) return 10.

OnCalculate() in indicator.ex5 returns 2450 (D1 rates total) even on closed market.

OnCalculate() in MTFindicator.ex5 returns nothing on closed market, due to the mentioned error 4806. After the new tick is received it returns 24500 (M20 rates total).

Is It not possible to get values from indicator.ex5 on different time-frame without tick update? Or do I need to use OnTimer somehow?

Thnaks

Peter

Sorry but I don't understand your issue. If your indicator.ex5 returns 2450 then BarCalculated must return 2450. Maybe it would be more easy if you can show your code.
 
angevoyageur:
Sorry but I don't understand your issue. If your indicator.ex5 returns 2450 then BarCalculated must return 2450. Maybe it would be more easy if you can show your code.

Hi,

I am using the same code as in this tutorial https://www.mql5.com/en/articles/127

The only difference is calling custom indicator with different time-frame from PERIOD_CURRENT

Handle=iCustom(_Symbol,PERIOD_D1,"TSIs",r,s,sp,sm);
How to Write an Indicator on the Basis of Another Indicator
How to Write an Indicator on the Basis of Another Indicator
  • 2010.07.26
  • Dmitry Fedoseev
  • www.mql5.com
In MQL5 you can write an indicator both from a scratch and on the basis of another already existing indicator, in-built in the client terminal or a custom one. And here you also have two ways - to improve an indicator by adding new calculations and graphical styles to it , or to use an indicator in-built in the client terminal or a custom one via the iCustom() or IndicatorCreate() functions.
 
P_Cherry:

Hi,

I am using the same code as in this tutorial https://www.mql5.com/en/articles/127

The only difference is calling custom indicator with different time-frame from PERIOD_CURRENT

This article don't talk about multi timeframe indicator. I doubt it can work by changing only this line of code.
 
angevoyageur:
This article don't talk about multi timeframe indicator. I doubt it can work by changing only this line of code.

Of course I know, but the same approach is used for the most of MTF indicators:

https://www.mql5.com/en/code/198

https://www.mql5.com/en/code/1757

https://www.mql5.com/en/code/177

None of them are able to show values on closed market and must wait for a new tick!

All of them shows the error 4806 on closed market (e.g.: Set time-frame to H1 and put indicator on 15min chart).

Peter

QQE [v02] and QQE multi-timeframe [v02]
QQE [v02] and QQE multi-timeframe [v02]
  • votes: 8
  • 2010.09.29
  • Armand Kilian
  • www.mql5.com
QQE - Qualitative Quantitative Estimation MA on RSI, Difference of MA on RSI and MA of MA of ATR of MA of RSI
 
P_Cherry:

Of course I know, but the same approach is used for the most of MTF indicators:

https://www.mql5.com/en/code/198

https://www.mql5.com/en/code/1757

https://www.mql5.com/en/code/177

None of them are able to show values on closed market and must wait for a new tick!

All of them shows the error 4806 on closed market (e.g.: Set time-frame to H1 and put indicator on 15min chart).

Peter

Ah ok, I will check that when I have some time.
 
is there any function can tell us if the market close or not?
 
song_song:
is there any function can tell us if the market close or not?
SymbolInfoSessionTrade. See also this topic.
 

Hi,

but I think there is no need for market status identification. The indicator should work on closed market as same as other simple indicators do.

TO angevoyageur: Did you try any of listed indicators on closed market?

Peter