Features of the mql5 language, subtleties and tricks - page 75

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 put the EA on the chart on Saturday, but the EA can get the time of the last tick, it is for example in the Market Watch 23:58, and my local 04:45. The server time I do not know.
Question: What is the time from the last tick to the server time (terminal time)?
I thought about it. It appears that there is no difference when an EA is attached to a chart. As long as there is no real tick, we cannot run the part of the program algorithm that uses the server's real time.
If calculations are required before the arrival of the tick, then request from the user ServerGMTOffset.
Thus, the problem can be solved even without ServerTradeTime().
I have given it some thought. It turns out that there is no difference when the EA is attached to the chart. As long as there is no real tick, you cannot execute that part of the program algorithm which uses the real server time.
If calculations are required before the arrival of the tick, then request from the user ServerGMTOffset.
Thus, the problem is solvable even without ServerTradeTime().
The user doesn't know the Offset of the server, he doesn't know it.
Only two values are known, and this data is not enough to calculate:"how much time has passed from the last tick to the server's(terminal's) time".
This is a very peculiar problem and I don't see a solution, like you do.
I put the EA on the chart on Saturday, but the EA can get the time of the last tick, it is for example in the Market Watch 23:58, and my local 04:45. The server time I do not know.
The question is how much time passed from the last tick to the server time (terminal time)
It's not just a time, it's a datetime. Ie both date and time. So, the arithmetic operation with these data will give the difference in seconds, which is not difficult to translate into days, hours, minutes and seconds.
In addition, you need to check on weekends what TimeTradeServer will show.
Pay attention to the discrepancy between the seconds of the server time and the local time, and then the exact match between local and estimated server time.Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql4 language, subtleties and tricks
fxsaber, 2018.03.29 14:32
I can remake this code for forex
Thanks, I'll take a look. But then again, there are not forex symbols.
How is it not convenient that you can not simply and briefly get the current time of the server, at any point in time.
Both are not just time, but datetime. That is, both date and time. So, the arithmetic operation with these data will give the difference in seconds, which is not difficult to translate into days, hours, minutes and seconds.
In addition, you need to check on weekends what TimeTradeServer will show, but so far it shows this way
Pay attention to the discrepancy between the seconds of the server time and the local time, and then the exact match between the local and the server's estimated time.I have also printed it, but how it can be used on weekends. In general, I should try to use this information.
The task is minimal:"how much time has passed from the last tick to the server's (terminal's) time".
Thanks, I'll take a look. But then again, there are non-forex symbols.
If the broker has at least one forex symbol, it will work for others.
If the broker does not have one Forex symbol, the question of reasonability arises.
Thanks, I'll take a look. But then again, there are not forex symbols.
How is it not convenient that you can not simply and briefly get the current server time, at any point in time.
I also have it printed, but how to use it at the weekend. In general, you need to rotate the information provided.
The task is minimal:"how much time has passed from last tick to server (terminal) time".
Of course, we should check it, but judging by the difference between TimeCurrent and TimeTradeServer, we can assume that the difference will grow.
Please tell me if my MQ-demo server time is the same as the time in Moscow.
It is necessary to check, of course, but judging by the difference between TimeCurrent and TimeTradeServer, we can assume that the difference will grow.
Please tell me if my MQ-demo server time is the same as my Moscow time and what it shows if server time is not the same as my local time.
Robo
My local time was 17:17:13
Forum on trading, automated trading systems and trading strategies testing
Bugs, bugs, questions
fxsaber, 2017.05.19 22:35
TimeTradeServer can return all sorts of nonsense. For example, a value less than TimeCurrent. This completely nullifies its practical application.
If I understand the idea correctly, TimeTradeServer should calculate the elapsed time after receiving TimeCurrent and add this difference, sort of emulating the future TimeCurrent values.
Now, having started the Expert Advisor
you can see any nonsense
Note the dates.
And who is to blame for this, the terminal, or the DC with crooked settings?