Login Page - Create Account

Support Board


Date/Time: Fri, 20 Sep 2024 00:39:25 +0000



DateTime to Index

View Count: 2332

[2014-08-21 13:46:06]
AC94882 - Posts: 8
Hi,
How can i get the current bar index of the chart by giving the datetime?

How can i get the OHLC values by giving the datetime?

Ariel
[2014-08-21 16:35:51]
Sierra Chart Engineering - Posts: 104368
Are you referring to the Advanced Custom Study Interface and Language?
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
[2014-08-21 16:59:20]
AC94882 - Posts: 8
Yes,
How to get the data with ACSIL
Thanks.
[2014-08-22 01:10:28]
vegasfoster - Posts: 444
You can see here http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scGetNearestMatchForSCDateTime and here http://www.sierrachart.com/index.php?page=doc/doc_SCDateTime.html

An example would be if you wanted daily open then could do something like,


SCSubgraphRef DailyOpen = sc.Subgraph[0];

SCSubgraphRef ReferenceIndex = sc.Subgraph[10];  
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "Daily Open";            
    sc.AutoLoop = true;

    DailyOpen.Name = "Daily Open";
    DailyOpen.LineWidth = 1;
    
    sc.Input[0].Name = "Hour";
    sc.Input[0].SetInt(9);

    sc.Input[1].Name = "Minute";
    sc.Input[1].SetInt(30);
    
    return;
  }

  int Year = sc.BaseDateTimeIn[sc.Index].GetYear();
  int Month = sc.BaseDateTimeIn[sc.Index].GetMonth();
  int Day = sc.BaseDateTimeIn[sc.Index].GetDay();
  SCDateTime DateTime(Year, Month, Day, sc.Input[0].GetInt(), sc.Input[1].GetInt(), 0);

  int InputIndex = sc.GetNearestMatchForSCDateTime(sc.ChartNumber, DateTime);
  ReferenceIndex[sc.Index] = sc.BaseDateTimeIn[sc.Index-1] < DateTime && sc.BaseDateTimeIn[sc.Index] >= DateTime ? InputIndex : ReferenceIndex[sc.Index-1];
  
  DailyOpen[sc.Index] = sc.Open[ReferenceIndex[sc.Index]];

Date Time Of Last Edit: 2014-08-22 01:11:39
[2014-09-03 05:56:18]
Sierra Chart Engineering - Posts: 104368
In response to the first post, these are the relevant functions:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scGetNearestMatchForSCDateTime
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scGetOHLCForDate
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