Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 06:18:44 +0000



Post From: How to distinguish Flex Renko from Universal Renko in ASCIL?

[2017-03-18 12:13:30]
DabbaDo - Posts: 146
FYI and FWIW to anyone who cares about this, the distinguishing name does exist in GetStudyName(0). Here is some code I use to pull it out. Not tested on every kind of symbol, so YMMV. I could have done more error checking, and Sierra Chart may break this with future changes, of course.
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);
    SCString token0 = tokens[0];
    if (tokens.size() < 3
      || token0 != sc.Symbol)
    {
      ccCode = barsPeriodType = "INVALID";
      return;
    }
    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++)
    {
      barsPeriodType += tokens[i];
    }
  }