![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
SymbolInfoInteger(...,SYMBOL_TIME)
I just noticed there is one symbol among 22 that is always one bar late... Precisely the one I am working with for testing. Must be a pure coincidence.
I just noticed there is one symbol among 22 that is always one bar late... Precisely the one I am working with for testing. Must be a pure coincidence.
Is not an offline symbol or anything ?
But using time[] does require setting as-series.
In MT4, buffers and MT4 predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.
To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
Is not an offline symbol or anything ?
I don't know what you can possibly mean given the last quote is 0 second old.
Can someone explain why there is one chart that doesn't want to draw a new bar?
Can someone explain why there is one chart that doesn't want to draw a new bar?
I don't think there are many telepaths here.
Forum on trading, automated trading systems and testing trading strategies
iTime not returning the current bar open time
Vladislav Boyko, 2023.08.16 21:35
I don't think there are many telepaths here
You don't need telepathy. I asked the question with written words and I exposed the issue clearly. What do you don't understand?
As for the pseudo code:
1. Loop though array or symbols
2. Print(iTime(SYMBOLS[i],PERIOD_CURRENT,0))
3. Notice one symbol is always late
4. Look at the chart of said symbol
5. The quotes are coming in but the new bar has not been drawn, explaining why it is late.
That's not supposed to happen in my book and I don't know how it does, but you guys know better what could be going on.
Should return the current bar open time, but I have an issue where it sometimes returns the previous bar time.
I didn't think it was possible.
Maybe if I RefreshRates() ? Edit: Nope. Still happenning.
Try the prices buffer array after copying rates to it using copyrates() into the new double array and then extract the required info like time and price info using the desired candle in the array index like array[0].time
I will look into it. Thanks for your help.
To recap, sometimes iTime(SYMBOLS[i],PERIOD_CURRENT,0) is late even though several new bars have appeared on the chart. Other times even the chart is late too.
Also, the chart is in use; I refresh quotes before each iTime call and GetlastError() reports no error.
I have greatly improved the situation by no longer using the demo account.
My best guess is that there is a problem with my broker's data. Funny how it only affects the symbol I'm working with while coding.
You don't need telepathy. I asked the question with written words and I exposed the issue clearly. What do you don't understand?
As for the pseudo code:
1. Loop though array or symbols
2. Print(iTime(SYMBOLS[i],PERIOD_CURRENT,0))
3. Notice one symbol is always late
4. Look at the chart of said symbol
5. The quotes are coming in but the new bar has not been drawn, explaining why it is late.
That's not supposed to happen in my book and I don't know how it does, but you guys know better what could be going on.
You need to stop your attitude if you want help on this forum.
You didn't provide working code to reproduce the issue, you didn't answer to question asked by people.
This is a technical forum, we don't need words, we need facts and useful information. Code, logs, settings and the like.