Login Page - Create Account

Support Board


Date/Time: Thu, 23 Jan 2025 14:38:58 +0000



ACSIL debug techniques Q

View Count: 1058

[2018-12-03 23:51:19]
User525733 - Posts: 126
Hi folks,

when debugging a custom study, I often need to run the code up until a specific bar where an issue might require more attention.

Problem is, I don't know how to identify the index of the bar of interest...so i can run the code up to it and then go step wise with a fine comb.

to clarify further: i apply the study to an intraday chart and notice some weird behavior around say...12:33:05....i wanna be able to run the code up until that specific bar where the artifact is...identified by bar index not time!

can you please share how you guys do it?

thanks
[2018-12-04 06:11:56]
enemyspy - Posts: 306
It depends on the situation. But How I might approach that is use is set int h,m,s time variables and get them using sc.BaseDateTimeIn[sc.Index], and then set a conditional breakpoint where as an example h ==12 && m == 32, and then step through it from there.

Problem is I don't really know how to set an indexed based break point when my point of reference is time. So that is how I narrow it down to the area of the chart I want to step through in those situations.

Another thing you can do is if it is completely crapping out at the index you are looking for. You can add a temporary line of code to the study
where you go:
sc.AddMessageToLog(std::to_string(sc.Index).c_str(),1);
And that will print every index until it craps out, and then you have your index.

Another Thing I sometimes do Is set an unconditional break point, and add sc.Index to the watch, and then I will trial and error add conditions to the break point for instance start with sc.Index >200. Then sc.Index >400 and keep changing it to see where it craps out. Then I know where the index is.
Date Time Of Last Edit: 2018-12-04 06:19:42
[2018-12-04 07:20:55]
Sierra Chart Engineering - Posts: 104368


Problem is, I don't know how to identify the index of the bar of interest...so i can run the code up to it and then go step wise with a fine comb.
What we do is add the Bar Numbering study to the chart and set it to not reset every day and number every bar.

Then we just simply add code that tests for a particular bar index and set a breakpoint on a temporary test like the following:
int Test = 0;

Or just simply use the conditional breakpoint functionality of the Visual C++ debugger which can noticeably slow down execution though.
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: 2018-12-04 07:21:34

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

Login

Login Page - Create Account