Support Board
Date/Time: Mon, 21 Apr 2025 13:08:38 +0000
[Programming Help] - How to get Broker's time?
View Count: 148
[2025-02-24 23:45:33] |
LTSys - Posts: 68 |
I'm trying to get the Broker's time in my study so I can calculate the offset from GMT on startup. The examples I see for the SCDateTime appear to only be for my local machine's time. Anyone know where in the docs I can find a function to do this? Thanks alot! Date Time Of Last Edit: 2025-02-24 23:46:03
|
[2025-02-25 05:55:35] |
seandunaway - Posts: 348 |
both unix timestamps and scdatetimes (including order fills) are already stored as utc it's only when displayed does it use the charts timezone offset. different display offsets are not different times the order fill data will be set with information provided by the trade route server so i don't understand the question Date Time Of Last Edit: 2025-02-25 06:13:22
|
[2025-02-25 05:58:18] |
seandunaway - Posts: 348 |
i guess if you're wanting to determine the lag between the quote server and your machine you could compare the incoming time and sales record's timestamp to your system time or the lag between the route server and your machine, comparing an order timestamp after acknowledgement, with your system time Date Time Of Last Edit: 2025-02-25 06:02:02
|
[2025-02-25 11:40:47] |
LTSys - Posts: 68 |
For example with MetaTrader, they have a TimeTradeServer function which returns the Broker's time, and they also have a TimeGMT function which returns GMT (UTC) time. Order times are usually displayed in the Broker's time. So on startup, without any open order, I can calculate the Broker's offset from GMT using those two functions. Getting the GMT time using a sc function is available but not sure how to get the Broker's time on startup? I can't inspect an order entry time because there may not be any orders open when the study starts. Date Time Of Last Edit: 2025-02-25 11:45:48
|
[2025-02-25 13:52:34] |
seandunaway - Posts: 348 |
there is only one true time. we humans just display it with different offsets which isn't really that relevant to diff the server will be accurate. if you're concerned about your machine's accuracy use your operating system to automate or ntp server again, every unix timestamp and scdatetime is stored in utc if you looked at a fill on two different computers, they would each show the fill in the respective computer's local time those metatrader functions are just applying offsets ACSIL Interface Members - Functions: sc.ConvertDateTimeFromChartTimeZone() ACSIL Interface Members - Functions: sc.ConvertDateTimeToChartTimeZone() ACSIL Interface Members - Functions: sc.ConvertDateTimeUTCToChartTimeZone() ACSIL Interface Members - Functions: sc.GetChartTimeZone() ACSIL Interface Members - Functions: sc.SetChartTimeZone() Date Time Of Last Edit: 2025-02-26 00:52:52
|
To post a message in this thread, you need to log in with your Sierra Chart account: