Login Page - Create Account

Support Board


Date/Time: Sat, 30 Nov 2024 00:34:01 +0000



HOWTO Convert Time To Seconds ?

View Count: 970

[2018-09-13 08:03:09]
User574685 - Posts: 28
HI,

it there some easy way in sierra to convert time to seconds ?

For example 1:20:50 = 4850 seconds ........


Thanks
Dave
Date Time Of Last Edit: 2023-01-01 19:37:14
[2018-09-13 14:35:09]
John - SC Support - Posts: 36350
Have a look at this page:
Working with the SCDateTime Variables and Values
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-12-31 18:56:22]
TriStar Trading - Posts: 142
Here is how I did it.

  //Set the configuration variables and defaults.
  SCSubgraphRef BarSeconds  = sc.Subgraph[0];

if (sc.SetDefaults)
{
//Set the configuration and defaults
sc.GraphName = "Bar Duration In Seconds;
  sc.GraphRegion = 1;  //Not Main graph region
sc.AutoLoop = 1;
  sc.ValueFormat = 0;
    
  //Define the Subgraphs
  BarSeconds.Name = "Bar Seconds";
  BarSeconds.DrawStyle = DRAWSTYLE_BAR;
  BarSeconds.LineWidth = 2;
  BarSeconds.PrimaryColor = RGB(128,128,128);
    
  return;
}

  SCDateTimeMS BarEndDateTime = sc.GetEndingDateTimeForBarIndex(sc.Index);
  SCDateTimeMS ElapsedTime = static_cast<float>((BarEndDateTime - sc.BaseDateTimeIn[sc.Index] + SCDateTime::MICROSECONDS(1)).GetAsDouble());

  BarSeconds[sc.Index] = ElapsedTime.GetTimeInSeconds();

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

Login

Login Page - Create Account