Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 13:14:33 +0000



Setting StudySubgraphName in ACSIL

View Count: 846

[2016-12-13 14:13:50]
Sporken - Posts: 82
Hi,

Is there a nice way in ACSIL to get/set the short name of a study subgraph? I'm able to read the existing name/shortname with sc.GetStudySubgraphName(id, sd) but it is returned as a const char *. Which implies that I shouldn't change the contents. I've found that I can hack it to change the characters but I'm concerned that an update might break my hack or some other code might overwrite my change. (I just want to decrement a counter that's stored in the short name. I plan to tag subgraphs with a special string to signify that my code should trade renko crossings with that subgraph.)

Also, how do I get the number of Studies applied to a chart? In the following code I have it hardcoded as 255. I cant find it anywhere.

also I'm using sc.Internal_GetStudyIDByIndex which might be bad as well. Is there a better way? I keep getting the last id repeated for all the superfluous calls.

Thanks in advance for your help!

-Jason



  SCString sss = SCString();
  for (int s_num = 0; s_num < 255; s_num++)
  {
    int id = sc.Internal_GetStudyIDByIndex(sc.ChartNumber, s_num);
    sss.Format("id = %d", id);
    sc.AddMessageToLog(sss, 1);

    SCGraphData StudyData;
    sc.GetStudyArraysFromChartUsingID(sc.ChartNumber, id, StudyData);
    int num_sd = StudyData.GetArraySize();

    for (int sd = 0; sd < num_sd; sd++)    //always 60?
    {
      SCFloatArrayRef FloatArray = StudyData[sd];
      int ar_siz = FloatArray.GetArraySize();
      if (ar_siz > 0)
      {
        const char *study_subgraph_name = sc.GetStudySubgraphName(id, sd);

        if (strlen(study_subgraph_name) > 0)
        {
          char *hack = (char *)(void *)study_subgraph_name;
          hack[1] = 'R';

          sss.Format("id = %d, sd = %d, sd_len = %d, fl_arr_len = %d, sg_name = %s",
            id,
            sd,
            StudyData.GetArraySize(),
            FloatArray.GetArraySize(),
            sc.GetStudySubgraphName(id, sd));

          sc.AddMessageToLog(sss, 1);
        }
      }
    }
  }


[2016-12-13 18:20:16]
Sierra Chart Engineering - Posts: 104368
There is no way to change the Subgraph Short Name for a different study compared to the study instance itself which is wanting to do that.


Also, how do I get the number of Studies applied to a chart? In the following code I have it hardcoded as 255. I cant find it anywhere.
There is no way to determine this.

It is OK to make a direct call to sc.Internal_GetStudyIDByIndex. In the next release we have added a wrapper function named sc.GetStudyIDByIndex().
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

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

Login

Login Page - Create Account