Login Page - Create Account

Support Board


Date/Time: Tue, 30 Apr 2024 13:15:34 +0000



Post From: ACSIL control of chart bar period and days to load

[2019-07-18 07:42:41]
Sierra Chart Engineering - Posts: 104368
What we want you to do is to test this study function below. Build it and apply the study to an Intraday chart and do a replay. The chart bars will change to 5 minutes. During the replay change the chart bars to 1 minute per bar and then they should automatically change back to 5 minutes.

SCSFExport scsf_BarPeriodParametersTest(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults.

    sc.GraphName = "Bar Period Parameters Test";

    sc.AutoLoop = 0;
    sc.GraphRegion = 0;
    sc.UpdateAlways = 1;

    return;
  }

  n_ACSIL::s_BarPeriod BarPeriod;
  sc.GetBarPeriodParameters(BarPeriod);
  if (BarPeriod.ChartDataType == INTRADAY_DATA && BarPeriod.IntradayChartBarPeriodType == IBPT_DAYS_MINS_SECS)
  {
    int SecondsPerBar = BarPeriod.IntradayChartBarPeriodParameter1;
  }

  SCString DebugString;
  DebugString.Format
    ( "Bar Period type=%d, parameters={%d, %d, %d, %d}."
    , BarPeriod.IntradayChartBarPeriodType
    , BarPeriod.IntradayChartBarPeriodParameter1
    , BarPeriod.IntradayChartBarPeriodParameter2
    , BarPeriod.IntradayChartBarPeriodParameter3
    , BarPeriod.IntradayChartBarPeriodParameter4
    );
  sc.AddMessageToLog(DebugString, 0);

  if (BarPeriod.ChartDataType != INTRADAY_DATA
    || BarPeriod.IntradayChartBarPeriodType != IBPT_DAYS_MINS_SECS
    || BarPeriod.IntradayChartBarPeriodParameter1 != 300)
  {
    n_ACSIL::s_BarPeriod NewBarPeriod;
    NewBarPeriod.ChartDataType = INTRADAY_DATA;
    NewBarPeriod.IntradayChartBarPeriodType = IBPT_DAYS_MINS_SECS;
    NewBarPeriod.IntradayChartBarPeriodParameter1 = 300;// 300 seconds per bar which is 5 minutes

    //Set the bar period parameters. This will go into effect after the study function returns.
    sc.SetBarPeriodParameters(NewBarPeriod);
  }
}

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