See: https://www.mql5.com/en/code/45287
Beside that:
long tSec = (long)TimeCurent();
gives you the seonds since 1.1.1970.
- www.mql5.com
See: https://www.mql5.com/en/code/45287
Beside that:
gives you the seonds since 1.1.1970.
I do not wish to use TimeCurrent() or TimeGMT() or TimeTradeServer()
I want bar time in seconds using iTime()
How can i get current bar's time in seconds
TimeGMT works fine but i want to get bar time in seconds
output
the seconds of the day ? or seconds in general ?
seconds in general
. same as output given by TimeGMT() as per screenshot i added, but using iTimeYou can use the
SymbolInfoInteger(_Symbol,SYMBOL_TIME)
, it returns the time of the last quote which is also part of the last bar.
Or
IntegerToString((long)iTime(_Symbol,_Period,0));
https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_integer
Unless you mean the time of the first tick of each bar , that needs some ninja stuff
If you are facing this in a tick processor then you need to :
- flatten the time based on seconds based on the duration of each bar of that timeframe in seconds
- project a duration in seconds unto that flattened bar time
- if a tick matches or crosses that projected time you know a new bar started and you also have the first tick time of that bar (and in ms if the broker has it)
- www.mql5.com
Wouldn't iTime always give you 0 seconds if bars open directly on the minute/hour?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How can i get current bar's time in seconds
TimeGMT works fine but i want to get bar time in seconds
output