Login Page - Create Account

Support Board


Date/Time: Wed, 19 Jan 2022 13:31:10 +0000



BaseDateTimeIn and current time stamp

View Count: 1405

[2013-06-05 01:02:36]
flyboy615 - Posts: 56
Hi
Has something changed in recent released with transact bridge for the time reported in the BaseDateTimeIn array? I have several studies that seem to no longer work correctly since I upgraded in the last few releases. It seems that the BaseDateTimeIn now only reports the start time of the bar ( it may always have ) but I seem to think that it gives the time of the last tick. How do you get the time tick by tick on a 5 min chart in order that the following code would now work correctly? This is code that has been in place for years but just lately seems to no longer work correctly. It executes 1 bar late since the time stamp of the closing bar now reports 9:00:00 instead of 9:04:59. I can provide more information as needed. Thanks

CurrentDateTime = sc.BaseDateTimeIn[sc.Index];
StartDateTime = COMBINE_DATE_TIME(CurrentDateTime.GetDate(),StartTime.GetTime());
EndDateTime = COMBINE_DATE_TIME(CurrentDateTime.GetDate(),EndTime.GetTime());

// start time = 9:00:00
// end time = 9:04:59
// HowManyMinutes = 30

if ((sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) &&
CurrentDateTime >= EndDateTime &&
CurrentDateTime <= ( EndDateTime+(HowManyMinutes.GetInt()*MINUTES))
{
//do some processing
}
[2013-06-05 01:24:12]
Sierra Chart Engineering - Posts: 99781
sc.BaseDateTimeIn contains the bar starting times. It never has been the ending time.
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
[2013-06-05 10:42:06]
flyboy615 - Posts: 56
Ok, So let me ask the question a different way. Is there an existing array element or function that will give the time stamp of the last tick that doesn't involve the system clock ( since they have a tendency to be always out of sync )?

Thanks

[2013-06-05 11:13:26]
Sierra Chart Engineering - Posts: 99781
No, there is not.
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
[2013-06-05 12:26:57]
ejtrader - Posts: 660
flyboy - Try - sc.LatestDateTimeForLastBar ( haven't tested - and don't know if this is what you are looking for or not )
[2013-06-05 12:56:48]
flyboy615 - Posts: 56
ej - interesting idea I will explore it a bit. Based on sierra's original answer I switched over the logic as follows.... in case anyone else is wondering..... seems to work well enough but will have to test a bit more in insure that it is flexible enough.

int intStartTimeIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber,StartDateTime);
int intEndTimeIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber,EndDateTime);
int intLastTradeIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber,EndDateTime+(HowManyMinutes.GetInt()*MINUTES));

if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED)
{
if (sc.Index >= intEndTimeIndex && sc.Index <= intLastTradeIndex)
{
// do some processing
}
}

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

Login

Login Page - Create Account