Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 14:19:42 +0000



Bar time calculations

View Count: 540

[2017-03-16 13:35:51]
User921987 - Posts: 234
Is this the correct way to calculate a time difference (in seconds) between 2 consecutive bars ?

double DifferenceInSeconds = (sc.BaseDateTimeIn[sc.Index] - sc.BaseDateTimeIn[sc.Index - 1]) * 86400.0;

Date Time Of Last Edit: 2017-03-16 13:36:43
[2017-03-16 18:32:09]
Sierra Chart Engineering - Posts: 104368
Yes this is correct.

This is going to be a little more accurate way to do it:
int DifferenceInSeconds = (int)((sc.BaseDateTimeIn[sc.Index] - sc.BaseDateTimeIn[sc.Index - 1]) * 86400.0 + .5f);

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-16 18:32:36

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account