Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 06:39:07 +0000



[Programming Help] - GetContainingIndexForSCDateTime function wrongly assign index

View Count: 354

[2024-03-14 23:42:13]
rtinada - Posts: 4
Hi Team,

I have:
Chart1 (1 minute bar chart)
Chart2 (1 trade per bar chart) - this chart is reference to chart 1.

Chart 1:
index 1053: bar started on 16:58
index 1043: bar started on 16:59
index 1044: bar started on 17:00

Chart 2:
index 56211 trade on 16:58:23.000621
index 56212 trade on 16:58:28.008621
index 56213 trade on 16:58:52.002621
index 56214 trade on 16:59:23.000621
index 56215 trade on 17:00:00 (this trade doesn't have milliseconds, I've checked also in input file)
index 56216 trade on 17:00:01.000023

And situation looks like this
GetContainingIndexForSCDateTime(2, 17:00) will return index 56216 and I believe it should return 56215
if I edit the record from 17:00:00 and I change it to 17:00:00.0001 then GetContainingIndexForSCDateTime(2, 17:00) will return index 56215

Is it a bug? If no, then could you suggest which function I should use to get index 56215 for records that don't have milliseconds?



Thanks!
Adam
[2024-03-17 21:19:59]
Sierra_Chart Engineering - Posts: 17172
The function you are referring to is a core Sierra Chart function used in charts. It would be very unlikely to have the problem you describe.

As we suspected, we ran a test and there is no issue.

This is the ACSIL test function call we used:
    int BarIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, SCDateTime(2024, 3, 15, 16, 59, 0, 0));

The returned index is zero-based and if you use the Bar Numbering study set to not reset every day and to label every bar, you will find that this index returned by sc.GetContainingIndexForSCDateTime, matches with what you see with Bar Numbering -1.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-03-18 20:16:07]
rtinada - Posts: 4
Hi,

I've attached a file with example where GetContainingIndexForSCDateTime returns wrong value

PS Red font color was by mistake, it doesn't mean I'm angry or anything

Regards
imageexample.png / V - Attached On 2024-03-18 20:13:12 UTC - Size: 110.23 KB - 60 views
[2024-03-19 05:07:18]
Sierra_Chart Engineering - Posts: 17172
It is completely impossible for us to analyze this from a screenshot. There is no way we have any idea what is actually happening, or how to validate any of this.

One problem that we see when you call GetContainingIndexForSCDateTime is you are specifying chart number 2, but the chart number we see in the screenshot at the top is chart #1.
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, use 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