Converting Server Time To Local Time

 
Does anyone have a code that converts server time to local time in the charts?

Using daily charts as an example, instead of updating at 00:00 GMT, they would update at 00:00 GMT-5, or whatever time you set.

I'm sure this would be possible, but I'm new to MT and not familiar with the code.

Can anyone help?

Thanks!
 
int TimeDiff = LocalTime() - ServerTime(); int time0 = StrToTime("12:31"); time0 += TimeDiff;

---
www.e2e-fx.net
EA development service
 
RickD:
int TimeDiff = LocalTime() - ServerTime(); int time0 = StrToTime("12:31"); time0 += TimeDiff;

---
www.e2e-fx.net
EA development service
Thanks for your input!

I've tried your code as an indicator and as a script, and in neither case did I see any change in my charts. I changed "ServerTime" to "CurTime", because it returned an error message, "ServerTime function is not defined". The code works when I compile it, but I don't see any change to the charts when I attach it. Is it only a partial code to what I should be doing? - Or maybe it doesn't update over the weekend (when the server isn't returning any new quotes)?

What I am trying to do is get a daily chart (for example) to update at 00:00 EST (i.e.: GMT -5) instead of at 00:00 GMT. The open and close would then be different than on the standard daily charts which update at 00:00 GMT, which is Server time (or CurTime). I assume that this would be similar to running a converter that would convert a 1 HR chart into a 6 HR chart. The chart should look different altogether.
 
Theres no way to change the time on the charts in real time. You may be able to change the date and time on your history files but why? I see no purpose in that.

If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done. Changing the time on the charts them self can not be done.

The CockeyedCowboy
 
CockeyedCowboy:
Theres no way to change the time on the charts in real time. You may be able to change the date and time on your history files but why? I see no purpose in that.

If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done. Changing the time on the charts them self can not be done.

The CockeyedCowboy
No, no - it's not that I want to have my local time show up on the charts along with broker time... It's not about displaying local time. - It's about having the bars on my charts update on a different schedule than server time.

What I'm hoping for is to have my daily charts based on my time zone (GMT -5) rather than server time, which is GMT. So, for example, instead of a new daily bar forming at 19:00 GMT - 5 (which is 00:00 GMT), it would form at 00:00 GMT - 5, (which is 5:00 GMT), or whatever time I choose. The OHLC would be completely different. If my trading method involves making entries and exits at the open, but I am not available to trade the open at 00:00 GMT, then I want to have my daily bars open at a time when I am available to monitor them and trade them.

I was playing around with an indicator that was posted here ("Period_Converter_Opt"), that allows you to create your own time frames, such as 3 min, 6 hr, or whatever you want that will update in offline charts. The OHLC's of those bars are based on whatever new time frame you create with the indicator. It's a great tool! I'm thinking that there must be a similar way to program the system so that it gives you bars (even if it has to be in an offline chart, like with the Period Converter) that are based on the time of your choosing. It could be based on tick data, couldn't it?
 
spot007:
CockeyedCowboy:
Theres no way to change the time on the charts in real time. You may be able to change the date and time on your history files but why? I see no purpose in that.

If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done. Changing the time on the charts them self can not be done.

The CockeyedCowboy
No, no - it's not that I want to have my local time show up on the charts along with broker time... It's not about displaying local time. - It's about having the bars on my charts update on a different schedule than server time.

What I'm hoping for is to have my daily charts based on my time zone (GMT -5) rather than server time, which is GMT. So, for example, instead of a new daily bar forming at 19:00 GMT - 5 (which is 00:00 GMT), it would form at 00:00 GMT - 5, (which is 5:00 GMT), or whatever time I choose. The OHLC would be completely different. If my trading method involves making entries and exits at the open, but I am not available to trade the open at 00:00 GMT, then I want to have my daily bars open at a time when I am available to monitor them and trade them.

I was playing around with an indicator that was posted here ("Period_Converter_Opt"), that allows you to create your own time frames, such as 3 min, 6 hr, or whatever you want that will update in offline charts. The OHLC's of those bars are based on whatever new time frame you create with the indicator. It's a great tool! I'm thinking that there must be a similar way to program the system so that it gives you bars (even if it has to be in an offline chart, like with the Period Converter) that are based on the time of your choosing. It could be based on tick data, couldn't it?
There is no way to change the time of the data as it appears on the charts in real time. It is possible to change your history files as you found out. but I ask what good would that be?
 
CockeyedCowboy:
Theres no way to change the time on the charts in real time. You may be able to change the date and time on your history files but why? I see no purpose in that.

If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done. Changing the time on the charts them self can not be done.

The CockeyedCowboy

To: The Cockeyed Cowboy

* You wrote: "If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done."

* If you could point me to some info on how to do that, I would surely appreciate it.

Thanks

 

 
barton:

To: The Cockeyed Cowboy

* You wrote: "If you want to have your local time show up on the charts along with broker time (sever time) or your broker time off set from your time, or both off set from GMT, that can be done."

* If you could point me to some info on how to do that, I would surely appreciate it.

Thanks


See Clock v 1.3

 

Hello

There MUST be a way to change the time to local. What is the point in designing trading software for use around the world that has it's local time in the charts displayed as something somewhere else?????

Reason: