Chart data loaded?

 

How do I know that all chart data is loaded? Sometimes the indicator already starts to calculate although it is still missing a few candles. For example, if you close the terminal in the evening and open it again in the morning. Then it sometimes takes a moment until he has loaded the remaining bars. Is there a way to determine when the bars are updated?

Thank you and best Regards

 
Don't try to use any price (or indicator) or server related functions in OnInit (or on load or in OnTimer before you've received a tick), as there may be no connection/chart yet:
  1. Terminal starts.
  2. Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
  3. OnInit is called.
  4. For indicators OnCalculate is called with any existing history.
  5. Human may have to enter password, connection to server begins.
  6. New history is received, OnCalculate called again.
  7. A new tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
 
Thank you William. Always very helpful. The thing is, in my onCalculate function, things are calculated that require an updated chart. Therefore I should wait until the history and everything else is updated. How can I then programmatically determine that it is ready?
 
Frika # The thing is, in my onCalculate function, things are calculated that require an updated chart.

You calculate the chart presented. You are over thinking it.

Reason: