Isn't TimeGMT() the GMT time and TimeLocal() the local time?
However I don't want anything to do with local time cause that's not what I'm looking for.
I just want to make a function that automaticlu can calculate the GMT and ServerTime diffrence so that you don't have to manually set the value so the news drops in on the right place.
Help anyone?
All broker times as I have tested so far has the minutes synced perfectly so there is no meaning including the minutes.
But if you would work with timelocal() then yes the minutes would be nesseseary to include. Or I'm I wrong?
Anyhow I only want the hourly diff calculated correctly so if it's 01:00 server time and 21:00 GMT time it should be able to pull it off and say it's -4
All broker times as I have tested so far has the minutes synced perfectly so there is no meaning including the minutes.
But if you would work with timelocal() then yes the minutes would be nesseseary to include. Or I'm I wrong?
Anyhow I only want the hourly diff calculated correctly so if it's 01:00 server time and 21:00 GMT time it should be able to pull it off and say it's -4
Your function is not reliable, and will sometimes provide a wrong value.
But it's as you wish.
Its resolved! No need for more help , thx!
In Mt5
int secs_offset=(int)TimeTradeServer()-(int)TimeGMT(); //so if your news are in gmt seconds timestamp ,to plot them on the chart you : datetime news_time_on_chart=(datetime)(_news_time_gmt+secs_offset);
in Mt4 you need to know your brokers gmt offset , or , make sure you are calling the following when the broker is active (and TimeCurrent is not frozen at 23:59)
int secs_offset=(int)TimeCurrent()-(int)TimeGMT(); //so if your news are in gmt seconds timestamp ,to plot them on the chart you : datetime news_time_on_chart=(datetime)(_news_time_gmt+secs_offset);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi.
I have been working with this news indicator and its working great for me but when someone far away uses it. The news don't comes in the right place.
Can someone please have a look at the code and see if there is something that is not right.
So here it makes the array with the news only including the relevant code
Here is the auto adjust function that should fix the broker GMT issue eaven if it has to shift day
And the GMT shift that I think has some issue
Ok TThat should be it.
Please let me know if you can see something that would make it not to work if the broker time diff is to huge or something else.
Thank you