Login Page - Create Account

Support Board


Date/Time: Sun, 21 Oct 2018 20:03:34 +0000



[User Discussion] - ACSIL - A function that returns the Bar Period Type and Setting

Support Request:
[2017-11-26 16:49:51]
yon - Posts: 299
Anyone knows an ACSIL function that returns the Bar Period Type and Setting?
For an example "3.00 Range" or "5 Min".
The sc.GetChartName(ChartNum)function does return a string that includes this info but during replays it returns a different string ("Replay SpeedX")and this is problematic for my code.
[2017-11-27 12:17:08]
DabbaDo - Posts: 103
Not a very good solution, but I parse GetStudyName(0). See SCExtensions.h/SCExtension.cpp at my public Github at https://github.com/dalebrubaker/BruSierraChart

void GetContinuousContractAndBarsPeriodTypeCodes(SCStudyInterfaceRef sc, SCString& ccCode, SCString& barsPeriodType)
  {
    SCString thisName = sc.GetStudyName(0); // like ESM7 [CB] Flex Renko 32-31-1 #5 --but Continuous None gives no []
    std::vector<char*> tokens;
    thisName.Tokenize(" ", tokens);
   const SCString token0 = tokens[0];
    if (tokens.size() < 3
      || token0 != sc.Symbol)
    {
      ccCode = barsPeriodType = "INVALID";
      return;
    }
   const auto token1 = tokens[1];
    int barsPeriodStartIndex;
    if (token1[0] == '[')
    {
      ccCode = token1;
      barsPeriodStartIndex = 2;
    }
    else
    {
      ccCode = "[C0]";
      barsPeriodStartIndex = 1;
    }
    for (size_t i = barsPeriodStartIndex; i < tokens.size() - 2; i++)
    {
     const auto token = tokens[i];
      const int len = strlen(token);
      if (len > 0)
      {
        barsPeriodType += tokens[i];
      }
    }
  }

[2017-11-27 12:52:25]
yon - Posts: 299
Many thanks DabbaDo this will definitely help. I've just checked and saw that unlike the sc.GetChartName() in the case of sc.GetStudyName(0) the bar period portion of the string doesn't change on replays.
[2017-11-29 04:14:20]
StevieD - Posts: 32
Unless I misunderstand the question, the SC "Are" functions are what you are looking for...

sc.AreTimeSpecificBars()
sc.AreRangeBars()
sc.AreVolumeBars()
and others.

Combine with sc variable calls like...
sc.SecondsPerBar
sc.VolumePerBar
sc.RangeBarType


HTH
[2017-11-30 20:57:47]
yon - Posts: 299
thanks StevieD, I'm not sure that the "Are" functions include all bar types.

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

Login


Login Page - Create Account