TimeTradeServer analogue for MT4 - page 6

 
fxsaber:

Check code

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

Checked

It shows everything correctly.

The check is not done correctly. Here's why:

  1. You didn't use the server I gave you (why did you even ask for this data if you didn't use it?).
  2. The value 2 appears in the code, which is exactly the number we're looking for. That's why everything fits. Take away this number and you get the offset 0. That is, the function does nothing, in fact, it always returns 0.
Try to run this code (with a 2) on a server whose offset is not equal to GMT+2. Everything will break.
 
Ihor Herasko:

The verification is not done correctly. And here's why:

  1. You didn't use the server I gave you (why did you even ask for this data if you didn't use it?)
  2. The code contains a value of 2. This is exactly the number we are looking for. That's why everything fits. Take away this number and you get the offset 0. That is, the function does nothing, in fact, it always returns 0.
Try to run this code (with a 2) on a server whose offset is not equal to GMT+2. Everything will break.

If the previous post could be interpreted differently than what I meant, I apologise.

The result was obtained on your investor account at Alpari. Also the AMP server, where the offset is different, was checked.

 
fxsaber:

If the previous post could be interpreted differently from what I meant, then I apologise.

The result was obtained on your Alpari investor account. Also the AMP server, where the offset is different, was also checked.

Really didn't understand if you checked on Alpari. If you checked, then point 1 is removed.

Back to point 2, what is the value of 2 in the code for? What is it for, if not to adjust to the current offset, which is exactly 2 hours? After all, anything before it will always and everywhere give 0. So there is no point in the expression:

MathRound((double)MathMin(Sunday - DAY - GetBarTime(Sunday), Sunday + DAY - GetBarTime(Sunday, true)) / HOUR)

no.

 

Managed to find a server which has a different GMT offset (New York).

On it the script finally goes crazy:

0       22:32:27.349    Test EURUSD,M1: TimeGMT() = 2019.12.03 20:32:27
0       22:32:27.349    Test EURUSD,M1: TimeServerGMT() = 2019.12.01 08:32:27

And it's no longer about the twos, as I assumed, but precisely about the complete artificiality of the chosen approach. After all, the minute history is turned upside down. We get completely differenttrading session times.

Who is interested to check, here is the account details:

Server name: BMFN-DemoCFD

Login: 33425755

Password: Invest111

Документация по MQL5: Получение рыночной информации / SymbolInfoSessionQuote
Документация по MQL5: Получение рыночной информации / SymbolInfoSessionQuote
  • www.mql5.com
Получение рыночной информации / SymbolInfoSessionQuote - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Dmitry Fedoseev:

.

Oh, you guys, you're a real piece of work.

 
Alexandr Gavrilin:

I'll tell you a terrible secret, not every day can end at 11:59 p.m. :-) And we may not know in advance what time it will end. For example on pre-holidays and Fridays.

You should keep your secrets to yourself or something will happen in the night :-)

and read carefully what it says - gold opens on amsterdam. Find the opening of the gold, you get a time stamp.

Same with any non round-the-clock assets - they have a known timetable/time reference in advance. You can tie it to the Chicago indices, for taste and colour

 
Ihor Herasko:

Managed to find a server which has a different GMT offset (New York).

On it the script finally goes crazy:

And it's no longer about the twos, as I assumed, but precisely about the complete artificiality of the chosen approach. After all, the minute history is turned upside down. We get completely different trading session times.

Who is interested to check, here is the account details:

Server name: BMFN-DemoCFD

Login: 33425755

Password: Invest111

Checked it on this account. Everything shows up perfectly.

 
Maxim Kuznetsov:

You should shut yourselves away from the dark secrets, or something will go wrong in the night :-)

and read carefully what is written - gold opens on amsterdam. You find the opening of the gold, you get a time stamp.

Same with any non round-the-clock assets - they have a known schedule/time reference in advance. You can link to the Chicago indices, for taste and colour.

OK, I'll ask a silly question.

How do you know if it's Saturday on the broker's server? It's not Friday or Sunday, it is 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 notrading 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.

Документация по MQL5: Получение рыночной информации / SymbolInfoSessionQuote
Документация по MQL5: Получение рыночной информации / SymbolInfoSessionQuote
  • www.mql5.com
Получение рыночной информации / SymbolInfoSessionQuote - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexandr Gavrilin:

If there are sensible solutions it would be interesting.

The solution was in the branch.

 
Vitaly Muzichenko:

It works, tested on 3 different ones. Checked in mt5

This may not be what TC needs, but it may take something from her

I will check your function on Saturday.