Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 01:56:10 +0000



CalculateTimeSpanAcrossChartBars for remote chart

View Count: 2407

[2017-09-02 07:05:27]
onnb - Posts: 660
Would want to be able to calculate the span for a remote chart. I would provide the remote start/last indexes obviously.

Any chance you can add option to provide chart number to this function?
[2017-09-02 11:10:50]
Sierra Chart Engineering - Posts: 104368
Will be in next release:
void sc.CalculateTimeSpanAcrossChartBarsInChart(int ChartNumber, int FirstIndex, int LastIndex, SCDateTime& TimeSpan);
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
[2017-09-04 04:29:50]
onnb - Posts: 660
what version is this in ?
[2017-09-04 18:40:00]
Sierra Chart Engineering - Posts: 104368
This will be in version 1608.
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
[2017-09-19 04:29:46]
onnb - Posts: 660
I've been working with this new method "CalculateTimeSpanAcrossChartBarsInChart"

Seeing something strange which I am not sure of.


I call the function with start and end indexes that are from a 1-tick chart.
The timestamps of the start/end indexes, as seen in the tools value window on the tick chart are:

StartIndex Timestamp: 14:40:59.003
EndIndex Timestamp: 14:42:00.041
EndIndex+1 Timestamp: 14:42:00.042

I get the span variable back and do something like this:

int hour, minute, second;
span.GetTimeHMS(hour, minute, second);

In the above example I am getting 56 seconds

Obviously those two minutes are continuous trading times.
I am expecting 61 seconds,

What am I missing?
[2017-09-19 05:27:08]
Sierra Chart Engineering - Posts: 104368
I call the function with start and end indexes that are from a 1-tick chart.
Are these the indexes belonging to the chart specified by the ChartNumber parameter with the function?
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
[2017-09-19 05:33:22]
Sierra Chart Engineering - Posts: 104368
The function doing the calculations does not have millisecond precision. We will add that if there are no unexpected complications. We think this is the reason for the problem.
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-09-19 05:33:38
[2017-09-19 05:51:18]
Sierra Chart Engineering - Posts: 104368
We have updated the function to do more precise calculations.

The calculations were not designed for high precision as you were expecting.
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
[2017-09-19 15:33:17]
onnb - Posts: 660
what version will this be available in?
[2017-09-19 18:00:32]
Sierra Chart Engineering - Posts: 104368
It is in the latest revision of Prerelease 1612 now.
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
[2017-11-16 07:34:19]
onnb - Posts: 660
I see the following scenario (by example)

I am using CalculateTimeSpanAcrossChartBarsInChart on a 1 tick chart

Start Session = 9:30:00
End Session = 9:00:00

The last tick of the prev session is 8:59:30
The 1st tick of the new session is 9:00:30
The 2nd tick of the new session is 9:00:30

Expecting 1 minute span.
Getting 30 second span.

I did a few more tests and from what I can see, the function does not count the time between the start of the session to the first tick - does that make sense?
[2017-11-16 07:38:42]
Sierra Chart Engineering - Posts: 104368

Expecting 1 minute span.
Getting 30 second span.
What are the timestamps of the bars this time span is for? It is not clear what you are referring to.
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
[2017-11-16 07:42:07]
onnb - Posts: 660
The timestamps are below

The last tick of the prev session is 8:59:30 (index==100)
The 1st tick of the new session is 9:00:30 (index==101)
The 2nd tick of the new session is 9:00:30 (index==102)

(Its a 1-tick chart so each tick is 1 bar)

I call CalculateTimeSpanAcrossChartBarsInChart(chartnumber, 100, 101, span)
[2017-11-16 07:53:23]
Sierra Chart Engineering - Posts: 104368
Based on the session times, these timestamps cannot possibly exist in the chart:

The 1st tick of the new session is 9:00:30 (index==101)
The 2nd tick of the new session is 9:00:30 (index==102)
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
[2017-11-16 18:24:30]
onnb - Posts: 660
My mistake, had a typo, see below

The last tick of the prev session is 8:59:30 (index==100)
The 1st tick of the new session is 9:30:30 (index==101)
The 2nd tick of the new session is 9:30:30 (index==102)


Start Session = 9:30:00
End Session = 9:00:00


I call CalculateTimeSpanAcrossChartBarsInChart(chartnumber, 100, 101, span)
Date Time Of Last Edit: 2017-11-16 19:15:50
[2017-11-16 19:23:05]
Sierra Chart Engineering - Posts: 104368
A result of 30 seconds makes sense.


The 1st tick of the new session is 9:30:30 (index==101)
The 2nd tick of the new session is 9:30:30 (index==102)
The time span between these chart bars would be considered 0.

You probably will want to use this array to do your own calculations:
http://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html#scBaseDataEndDateTime
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
[2017-11-16 19:37:31]
onnb - Posts: 660
The time span between these chart bars would be considered 0.
That is understood

Notice that the call uses indexes 100 and 101 - CalculateTimeSpanAcrossChartBarsInChart(chartnumber, 100, 101, span)
So the span is basically CalculateTimeSpanAcrossChartBarsInChart(chartnumber, 8:59:30, 9:30:30, span) with a 30 minute no trading period in between

Let me try and be more clear about this

Start of span, index 100: 8:59:30
End of session: 9:00:00
Start of session: 9:30:00
End of Span, index 101: 9:30:30

In this case, we are expecting to get 60 seconds
30 seconds from the start of the span to the end of the session
30 seconds from the start of the session to the end of the span

Btw, it doesn't really matter of index 102 is in the same second as index 101.
The time window between the start of the session and index 101 is not counted is where the question lies.

For example, if index 102 was 9:30:35 we would get
Span = 30 + 5 = 35
We would expect 30+30+5 = 65

Hope this makes it more clear.
Date Time Of Last Edit: 2017-11-16 19:39:05
[2017-11-16 19:48:58]
Sierra Chart Engineering - Posts: 104368
The reason we made reference to index 102, is because that is involved in the calculation of the time span for 101.


30 seconds from the start of the session to the end of the span
It does not work this way.
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
[2017-11-17 05:25:58]
onnb - Posts: 660
It does not work this way.

Not 100% clear on this - does that mean its a bug or was this the intended behaviour? Just seems strange that the start of the session would not be included as that time is part of the trading hours.
[2017-11-17 05:34:38]
Sierra Chart Engineering - Posts: 104368
This is the intended behavior.

The time span is computed individually for each chart bar.
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
[2017-11-17 20:13:20]
onnb - Posts: 660
This is the intended behavior.

Just pointing out that this behavior does not make sense to us. It appears logical to us that the time span between bar 100 and 101 would include all trading time from the start of bar 100 to the end of bar 101.

Understand that you have your considerations regarding priorities and assumptions.
That said, is this something you can review and reconsider?
[2017-11-19 22:24:12]
Sierra Chart Engineering - Posts: 104368
Onn, it may not make sense to you, but from the perspective of how it is designed, it is 100% correct. We simply cannot change this because there is a reliance on how it works. Refer to the updated documentation for the function for an explanation.

You need to implement your own calculation method. Let us know what functions you need to support that.
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

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

Login

Login Page - Create Account