stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

LocalTime
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4393
Page 1 of 1
Author:  renexxxx [ Wed Aug 19, 2015 12:11 pm ]
Post subject:  LocalTime

The "time" topic has been discussed many-many times on this forum. This little utility will help translate server times to local times.

It looks like this:
Selection_101.jpg
Four parameters:
- DateFormat: Default: "D/M/y H:I" (Some people want it as: "M/D/y H:I")
- MaxBars: Default: 200 (The number of bars for which you need the local time).
- LineColor: Default: White
- TextColor: Default: White
- ServerGMTOffset: Default: 3

It works out the time shift between the server time and you local computer time. When the server time is running, it can determine the time shift automatically, just by looking at the latest candle time and the local time, comparing the two and adjusting for the small difference in minutes and seconds. In the weekend and in general when the server has stopped, it relies on the correct setting of ServerGMTOffset to work out the time shift.

Also, it works out if there is enough space (in pixels) available to add the 'mileStone' labels. In any case, the tooltip text for each time 'tick' will tell you what the local time is. So, just hover the mouse over these 'ticks' and you'll know.

Any issues ... let me know.
Author:  Wobstix [ Wed Aug 19, 2015 3:46 pm ]
Post subject:  LocalTime

Looks very nice renexxxx
I will certainly give it a whirl.
Thank you.
Author:  woodlands [ Fri Aug 21, 2015 7:11 pm ]
Post subject:  LocalTime

This will stop a lot of 'head scratching' posts. (and 'time' wasting :? )
As usual with your code it works smoothly and efficiently
Thanks Renexxxx
Author:  SteveHopwood [ Fri Aug 21, 2015 10:45 pm ]
Post subject:  LocalTime

Thanks again Rene. Would you like me to add this to my wrup?

Think carefully before replying, "Yes."

Several hundred dimwits with the ability to read your thread but without the ability to understand even the most basic of basics will ask for clarification of, "DateFormat".

Yes, you explained it.

No, they did not understand it. And will post the same question. In only slightly different words. Again and again and again............................

Over to you Rene, and I will do whatever you want me to do. Just bear this in mind: there are good and cogent reasons why questions about time are banned in my threads.

Frankly, for your sanity I suggest you delete the entire thread but I leave that up to you.

Thanks again for your unstinting attempts to help SHF members. You are a star. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
Author:  renexxxx [ Fri Aug 21, 2015 11:03 pm ]
Post subject:  LocalTime

SteveHopwood » Sat Aug 22, 2015 8:45 am wrote:Thanks again Rene. Would you like me to add this to my wrup?
It's a pleasure Steve. But "no", I don't think it needs to go in the "wrup". Your post here, should have drawn enough attention to this thread already. And for those who missed it, tough luck.
SteveHopwood » Sat Aug 22, 2015 8:45 am wrote: Frankly, for your sanity I suggest you delete the entire thread but I leave that up to you.
I think I take the risk and leave it up. I expected a post from someone, advising that it doesn't work when the server time has stopped, and that the times are wrong in the weekend. So far, this hasn't happened yet. Still early days....
Author:  SteveHopwood [ Fri Aug 21, 2015 11:12 pm ]
Post subject:  LocalTime

Good luck. You need it.

:xm:
Author:  renexxxx [ Sat Aug 22, 2015 12:39 am ]
Post subject:  LocalTime

I have posted an update to this indicator in Post 1.

The indicator needs the time shift between server time and local time to convert the candle times (that are expressed in server time) to local times. When the server clock is running, this can be done automatically. In the weekend we need to rely on the correct setting of a new parameter called ServerGMTOffset. Normally, I like to avoid relying on the correct settings of user input parameters, as people forget to adjust them eg when the server changes their GMT Offset. Anyway, it is only required to get the setting for ServerGMTOffset right for when the server clock is not ticking. Note that, on weekends, the very first time that the indicator is loaded it hasn't figured out yet that the server clock has stopped -- so the times are wrong. This is corrected on the next update (5 seconds). Changing time frames counts as a reload of the indicator. However, changing the zoom level does not.

Hope not to have confused anybody too much.
All times are UTC Page 1 of 1