Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 07:30:39 +0000



[Programming Help] - CurrentDate Time Trouble

View Count: 669

[2019-11-02 17:03:03]
User312841 - Posts: 25
Seems like this should be an easy answer for a real programmer, I have not been able to find the answer.

I want to put a marker (horizontal line in this case) at the same time each day. But it only displays on the chart in the most recent day. I tried persistent variables and in this example a global variable. Graph shows it working for the current day, what is the code to make it display in previous days.

Thanks

// Data processing

  sc.DataStartIndex = 0;
  
  SCDateTime TimeToCheckFor;

  //The first step is to get the current date.
  int CurrentDate = sc.BaseDateTimeIn[sc.ArraySize - 1].GetDate();

  //Apply the time. For this example we will use 12 PM
  TimeToCheckFor.SetDate(CurrentDate);
  TimeToCheckFor.SetTimeHMS(12, 0, 0);


  //float LineVal = sc.Input[0].GetFloat(); // get integer value from Input 0
  
  // TimeToCheckFor is contained within the current bar.
  if (sc.IsDateTimeContainedInBarIndex(TimeToCheckFor, sc.Index))
  {
    g_highNoon = sc.RoundToTickSize(sc.BaseDataIn[SC_HIGH][sc.Index]+.00,0.01);
  }
  sc.Subgraph[0][sc.Index] = g_highNoon;
}

http://www.sierrachart.com/image.php?Image=1572713613953.png
[2019-11-03 16:27:39]
User312841 - Posts: 25
You can close this issue, I found a work around, and a realization that ASCIL programming is a much steeper climb than I naively thought.

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

Login

Login Page - Create Account