How can I get the broker's server datetime?

 

Using python with mt5

https://www.mql5.com/en/docs/python_metatrader5/mt5login_py

How can I get the broker's server datetime?

Documentation on MQL5: Python Integration / login
Documentation on MQL5: Python Integration / login
  • www.mql5.com
login - Python Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Please search before you post ...

Forum on trading, automated trading systems and testing trading strategies

Is there a way to know the Broker's Timezone using the Python API for MT5?

Fernando Carreiro, 2023.10.20 21:22

I was under the impression that the Python API offered functions equivalent to MQL5's TimeCurrent and TimeTradeServer, but it seems it does not.

I'm not a Python programmer, so I don't know if there are other workarounds to the issue, but the only thing I can think of at the moment, is to wait for an incomming tick, and then calculate the time difference, using the tick's timestamp and comparing it to the current UTC time.

Forum on trading, automated trading systems and testing trading strategies

Is there a way to know the Broker's Timezone using the Python API for MT5?

Fernando Carreiro, 2023.10.20 21:26

Another option is to monitor the "time" from symbol_info and when it changes, compre it to the UTC for calculating the difference.

This is somewhat similar to the tick timestamp example in the previous post.

Forum on trading, automated trading systems and testing trading strategies

Is there a way to know the Broker's Timezone using the Python API for MT5?

Alain Verleyen, 2023.10.21 03:14

You know your local time.

You know your local timezone, so GMT shift, it's easy to get it with Python.

When you get live ticks data, you get the "live" server time, like Fernando suggested.

From these information it's trivial to calculate the broker server time shift related to GMT. All of that can be done by code, there is no need to hardcode anything.

 
You need to contact metaquotes and have this changed this is terrible.
 
gouki1001 #: You need to contact metaquotes and have this changed this is terrible.

I don't need to do anything. I don't even like Python and don't use it.

If you have a complaint or suggestion, then take it up with MetaQuotes yourself.

 
Fernando Carreiro #:

I don't need to do anything. I don't even like Python and don't use it.

If you have a complaint or suggestion, then take it up with MetaQuotes yourself.

Maybe you should do something you are a Moderater you could try.

 
gouki1001 #: Maybe you should do something you are a Moderater you could try.

Moderators are normal users with a few extra privileges (and obligations).

We are not admin, nor developers, nor even employees (we don't even get paid).