Within OnCalculate, how can I know if the current bar has ended (the last tick was received) without waiting for the start of a next bar? - page 2

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
I did that and confirmed: both my brokers (actually their base, XP, is the same) don't give that information :(
Funny fact is that I did some research on Google (and IA) on how to handle this problem and I found another Brazilian trader reporting the same SymbolInfoSessionTrade/Quote problem ^^ I'm going to report that to the broker and hope it will change, but in the middle time, I'm going to study the alternatives that I found, including some similar to the link you provided. Since I found other posts (mainly from MQL4) reporting the same kind of doubt, whatever solution I found, I'll bring it here.
Most Brazilian brokers are incompetent in terms of technical skills needed to manage MT5 servers.
It's a broker issue, not an MT5 one.
Most Brazilian brokers are incompetent in terms of technical skills needed to manage MT5 servers.
It's a broker issue, not an MT5 one.
Well I'm really not surprised to read that :T Brazil does have some limitations in the technological area and the stock, futures etc. market is really 'underdeveloped' considering how big is or GDP.
Anyways, I'm back to share my works' results. To recapitulate: I want my indicator to analyse and send alerts ASAP when a bar is closed. In highly liquid assets, that's OK, but the challenge is in low liquidity ones and to analyze the last bar, when the market is already closed. For intraday, I implemented something in the lines of what was previously suggested: everytime the indicator is loaded or a new tick rises belonging to a new bar, a timer is set to check for alert conditions at the time corresponding the next bar. In accordance with my tests, this is working fine. The challenge now is the daily, weekly and monthly charts.
In the D1 case, the end of the current bar doesn't normally correlates with the end of the asset's market, so I can't rely on the bar and the current timeframe to configure the timer; what I need is to know when the market closes. As noted, the official way of knowing this is with the function "SymbolInfoSessionTrade", but it doesn't always work and I really want to avoid requiring the user to manually input that information in the input variables.
So what I've implemented so far are the following steps:
I did not dig into it thoroughly, but at 1-st glance it looks decent. The only thing I'd change is to gather closing stats by week days for all available bars on chart (not only last 290) - then get the most frequent HH:MM for specific day.