Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 16:26:03 +0000



Post From: plot multiple subgraphs to different regions from single study

[2020-10-22 19:25:01]
jomo88 - Posts: 47
I came up with the following solution. I am wondering if it is the most efficient solution memory wise and/or computationally. Running multiple instances of the study that I want to plot subgraphs from is not an option, as it has already maxed out computer resources.

#include "sierrachart.h"
SCDLLName("PlotStudyData")
SCSFExport scsf_PlotStudyData(SCStudyInterfaceRef sc)

{
SCSubgraphRef Subgraph_Copy = sc.Subgraph[0];
SCInputRef StudySubgraphReference = sc.Input[0];

if (sc.SetDefaults)
{
Subgraph_Copy.Name = "Copy For Region Plot";
Subgraph_Copy.DrawStyle = DRAWSTYLE_LINE;
Subgraph_Copy.PrimaryColor = RGB(0,255,0);
Subgraph_Copy.DrawZeros = false;
  
StudySubgraphReference.Name = "Study And Subgraph To Display";
StudySubgraphReference.SetChartStudySubgraphValues(1,1,3); // Chart, Study, Subgraph
return;
}

SCFloatArray StudyReference;
sc.GetStudyArrayFromChartUsingID(StudySubgraphReference.GetChartStudySubgraphValues(), StudyReference);

for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
{
Subgraph_Copy[Index] = StudyReference[Index];
}

}

Can you advise me if this is the optimal solution? I am assuming this study will use the memory required to store just Subgraph_Copy. Is memory being used twice with StudyReference? I think its required, correct?

Thank you
Date Time Of Last Edit: 2020-10-22 19:45:10