TimeTradeServer analogue for MT4 - page 7

 
fxsaber:

Check code


Result on a machine that has the same GMT as Alpari.


Checked

Everything is correct.

I have to check this function on Saturday and on Sunday. It will not fail on weekdays.

 
fxsaber:

Tested it on this account. It shows everything perfectly.

Do you think it's perfect?

0       08:46:44.975    Test USDCHF,H4: TimeGMT() = 2019.12.04 06:46:44
0       08:46:44.975    Test USDCHF,H4: TimeServerGMT() = 2069.10.31 23:46:44

69 instead of 2019...

 
Alexandr Gavrilin:

OK, I'll ask a silly question.

How do I know that it's Saturday on the broker's server? Not Friday or Sunday, but Saturday. I try to use all available instruments and different crutches like "let's buy the time and compare it later" - time doesn't tick when it is Saturday on the broker's server. However, on Sunday the market may open earlier and no trading session settings at the broker will help you determine this because the time is not ticking.


If you have a sensible solution it will be interesting.

Broker time may not always coincide with gmt time :-)

You are thinking too narrowly now, not everyone has gold to be tied to his time and know the gmt for example like you suggested. You need a more universal solution.

in history (underlined and highlighted) see what time the server started bidding on the symbol, the bidding start time of which is known. Get the GMT offset of the server. You know the GMT offset of the terminal. Add the result to the local time, which is always ticking, and get the server time exactly.

If your broker's time doesn't coincide with the time zone (GMT+3.05), then you should run away from such a broker :-) This is a kitchen without admins

 
Ihor Herasko:

Do you think this is ideal?

69 instead of 2019...

2019.12.04 08:53:49.118 Test5-3 USDCHF,H4: TimeServerGMT() = 2019.12.04 06:53:51
2019.12.04 08:53:49.117 Test5-3 USDCHF,H4: TimeGMT() = 2019.12.04 06:53:49
 

how do you explain this?

in the terminal


 
Alexandr Gavrilin:

how do you explain this?

Read

Forum on trading, automated trading systems and trading strategies testing

Peculiarities of mql4 language, subtleties and tricks

fxsaber, 2018.03.29 14:32

// Работает для FOREX-символов, когда M1-история доступна за ближайшую неделю

The function will work if run on a forex symbol. It only needs to be run once.

All other symbols will have the same GMT value as the first run on the forex symbol will show.


Instead of reading one sentence, there is some nonsense going on here for many pages.

 
fxsaber:

Read

The function will work if run on a forex symbol. It only needs to be run once.

All other symbols will have the same GMT value as the first run on the forex symbol will show.


Instead of reading one sentence, there is some nonsense going on here for many pages.

well on a currency it works on a trading day, will it work on a non-trading day?

 
fxsaber:

Read

The function will work if run on a forex symbol. It only needs to be run once.

All other symbols will have the same GMT value as the first run on the forex symbol will show.


Instead of reading one sentence, there is some nonsense going on here for many pages.

Have these accounts been tested on? On which the trading starts on a Sunday.


 
Alexandr Gavrilin:

Well on a currency it works on a trading day, will it work on a non-trading day?

Of course it will. Now ran it on offline custom symbol, everything is correct.

TimeServerGMTOffset() = -7200
 
Alexey Viktorov:

Have these accounts been tested on? The ones where trading starts on a Sunday.

I don't remember checking them. You should try it.