Support Board
Date/Time: Sat, 11 Jan 2025 17:41:10 +0000
Post From: Setting StudySubgraphName in ACSIL
[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); } } } } |