Are you required to carry out a manual data check and/or resynchronisation before using Indicator data??

 

Hi,

As many of you would be aware, you need to carry out a manual data check and/or re-synchronisation of your pricing data before doing a CopyOpen(), CopyHigh() etc if you want to ensure you have the most recent data available. However, what's the situation with accessing Indicator data using CopyBuffer()? The manual states the following:

 

"When requesting data from the indicator, if requested timeseries are not yet built or they need to be downloaded from the server, the function will immediately return -1, but the process of downloading/building will be initiated.

When requesting data from an Expert Advisor or script, downloading from the server will be initiated, if  the terminal does not have these data locally, or building of a required timeseries will start, if data can be built from the local history but they are not ready yet. The function will return the amount of data that will be ready by the moment of timeout expiration. "

 

When I first got into MQL5, I read this to mean that any price data access basically required a data check and/or manual resynchronisation if you wanted to make absolutely sure that you had the latest data,  whereas if an INDICATOR data request is carried out (using CopyBuffer within an Expert), CopyBuffer() will return a -1 until such time as the data is fully synchronised.

However, reading this again, I'm now taking it to mean that if data requests are carried out from within custom indicator code, a -1 will be returned if data isn't ready? And if a call to ANY pricing data (including Indicator data) using any of the CopyXXX() functions (including CopyBuffer()) is made from within an Expert or Script, a manual sync should be carried out beforehand?

As you're probably aware by now, I'm a bit confused on this one - any help would be greatly appreciated!!

 
cowil:
...

You don't need a "manual synchronisation". When you try to access data not yet available the function return -1 and requested data are automatically downloaded or built. When such function return -1, I simply wait for next tick by using "return()" in OnTick or OnCalculate.

 
angevoyageur:

You don't need a "manual synchronisation". When you try to access data not yet available the function return -1 and requested data are automatically downloaded or built. When such function return -1, I simply wait for next tick by using "return()" in OnTick or OnCalculate.

Hi,

Yeah, I've basically been doing the same for quite a while. I've found that a manual re-synch definitely needs to be carried out for any CopyXXX commands apart from CopyBuffer() which as you say, appears to return a -1 until all data is synchronised. It was just when I was re-reading it yesterday, I got a bit confused and thought I'd better double check.... :)

 
How to manual sync data?
Documentation on MQL5: Market Info / SymbolIsSynchronized
Documentation on MQL5: Market Info / SymbolIsSynchronized
  • www.mql5.com
Market Info / SymbolIsSynchronized - Documentation on MQL5
 
Candles:
How to manual sync data?
Oh, I got my answer in my own question. Nevermind.
 
Candles:
Oh, I got my answer in my own question. Nevermind.
I hope you realise that it's not just a simple IsSymbolSynchronized()? A function such as described here (https://www.mql5.com/en/docs/series/timeseries_access) needs to be carried out as your terminal's data might be synchronised with that of the server but your terminal may not as yet have constructed/updated the HC data...
Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
  • www.mql5.com
Timeseries and Indicators Access / Organizing Data Access - Documentation on MQL5
 
cowil:
I hope you realise that it's not just a simple IsSymbolSynchronized()? A function such as described here (https://www.mql5.com/en/docs/series/timeseries_access) needs to be carried out as your terminal's data might be synchronised with that of the server but your terminal may not as yet have constructed/updated the HC data...
Thank you for the clarification. It is good information.