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:
calculated=BarsCalculated(handle); //returns 0 on closed market with time-frame different from D1 !!!
Did you checked your handle is valid ?
What is the returned value of OnCalculate() for indicator.ex5 ?
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?
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
Of course I know, but the same approach is used for the most of MTF indicators:
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).
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?