Login Page - Create Account

Support Board


Date/Time: Tue, 27 Oct 2026 03:14:20 +0000



[Programming Help] - cannot get time in ATBB

View Count: 36

[2026-10-27 00:17:20]
walt_IB - Posts: 7
I am attempting to debug and it looks the "sc.BaseDateTimeIn[sc.Index]" does not seem to work.
I put a stop where "exitnow" is set and it never hits...


int hour = 0;
int minute = 0;
int second = 0;
bool exitNow;
SCDateTime barTime = sc.BaseDateTimeIn[sc.Index];
barTime.GetTimeHMS(hour, minute, second);
if (hour == 15 && minute >= 44 )
{
exitNow = true;//never gets here
}
Can something else be used to get the time of the bar?
>> I've had the same issue running live...
Date Time Of Last Edit: 2026-10-27 00:57:46
[2026-10-27 01:22:54]
Sierra_Chart Engineering - Posts: 25290
What is the timeframe of an individual 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, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2026-10-27 01:23:06
[2026-10-27 01:27:22]
walt_IB - Posts: 7
2 minute TF...
>> I also tried slow replay and it also never sets the "exitNow"...
My study has been working fine except for this...
[2026-10-27 02:56:24]
User719512 - Posts: 516
Add the Bar Numbering study to your chart, set Bar Index input to Yes.
Locate a bar where your signal should fire and note its index.

Add to your code something like:


if (sc.Index == 100) // whatever this # should be
{
int hour = 0;
int minute = 0;
int second = 0;
SCDateTime barTime = sc.BaseDateTimeIn[sc.Index];
barTime.GetTimeHMS(hour, minute, second);
SCString msg;
msg.Format("%d, %d %d %d", sc.Index, hour, minute, second);
sc.AddMessageToLog(msg, 1);
}

...or if you build locally, set a breakpoint and inspect your code and find the bug.

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

Login

Login Page - Create Account