Login Page - Create Account

Support Board


Date/Time: Fri, 04 Jul 2025 22:27:45 +0000



Post From: iterate over all charts and studies in a chartbook

[2020-07-25 14:30:59]
User462086 - Posts: 196
just found this old thread while looking for a way to iterate over studies on a chart. the following is working for me. might be able to use the same idea for charts too.


SCSFExport scsf_IterateStudiesOnChart(SCStudyInterfaceRef sc){
  
  SCInputRef HighestStudyIndex= sc.Input[0];
  
  if (sc.SetDefaults){
    
    sc.GraphName = "Iterate Studies";
    sc.AutoLoop = 0;

    HighestStudyIndex.Name = "Highest Study Index";
    HighestStudyIndex.SetInt(2);
    
    return;
  }
    
  // iterate over chart studies
  
  for (int idx = 1; idx <= HighestStudyIndex.GetInt(); idx++){
    
    int studyID = sc.GetStudyIDByIndex(sc.ChartNumber, idx);
    SCString studyName = sc.GetStudyNameUsingID(studyID);
    
    if (!studyName.IsEmpty()){
      
      // do something (eg, skip processing of this study!)
    }
  }
}

Date Time Of Last Edit: 2020-07-25 14:31:18