Support Board
Date/Time: Mon, 07 Jul 2025 01:40:46 +0000
Post From: Help with custom horizontal study.
[2019-04-08 14:48:41] |
ozunainc - Posts: 16 |
Ackin, thank for the reply, but the code you send me is not what im looking for. I was able set a different STUDY by changing the code " GridStart.SetFloat(7000.0f);" (ackin, this is used for manual inputs) with "GridStart.SetStudySubgraphValues(0,0);" (which gives the option to pick a studyid and the studyid subgragh from the current chart). my only problem is that i'm not see the values from the ref. studyid and subgraphid. I belive the code I need to change is in the data processing. "float GridStartVal = GridStart.GetFloat()-GridSpacingVal;" (this is what I need to change) WITH SAME THING LIKE : I just keep getting error. // Do data processing //This will return sc.UpdateStartIndex or an earlier index if this study is calculated after a study which calculated at an earlier index and supports setting that earlier index. int ActualStartIndex = sc.GetCalculationStartIndexForStudy(); // Get the array for the specified Input Data from the specified studies SCFloatArray Study1Array; sc.GetStudyArrayUsingID(Input_StudySubgraphReference.GetStudyID(), Input_StudySubgraphReference.GetSubgraphIndex(), Study1Array); for (int BarIndex = ActualStartIndex; BarIndex < sc.ArraySize; BarIndex++) { Subgraph_StudySubgraphReference[BarIndex] = Study1Array[BarIndex]; } sc.EarliestUpdateSubgraphDataArrayIndex = ActualStartIndex; } Ackin, or any one please help Thanks again. // The top of every source code file must include this line #include "sierrachart.h" // For reference, refer to this page: // Advanced Custom Study Interface and Language (ACSIL) // This line is required. Change the text within the quote // marks to what you want to name your group of custom studies. SCDLLName("Studysharedll") //This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require. //*============================================================================*// SCSFExport scsf_Studyshare(SCStudyGraphRef sc) { SCSubgraphRef L1 = sc.Subgraph[0]; SCSubgraphRef L2 = sc.Subgraph[1]; SCSubgraphRef L3 = sc.Subgraph[2]; SCSubgraphRef L4 = sc.Subgraph[3]; SCSubgraphRef L5 = sc.Subgraph[4]; SCInputRef GridStart = sc.Input[0]; SCInputRef GridSpacing = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "Studyshare"; sc.ScaleRangeType = SCALE_SAMEASREGION; sc.DrawZeros = 0; sc.GraphRegion = 1; sc.ValueFormat = 3; sc.AutoLoop = 1; sc.FreeDLL= 1; GridStart.Name = "Grid Starting Number"; GridStart.SetStudySubgraphValues(0,0); GridSpacing.Name = "Grid Spacing"; GridSpacing.SetFloat(0.05); L1.Name = "L1"; L2.Name = "L2"; L3.Name = "L3"; L4.Name = "L4"; L5.Name = "L5"; return; } float GridSpacingVal = GridSpacing.GetFloat(); float GridStartVal = GridStart.GetFloat()-GridSpacingVal; L1[sc.Index] = GridStartVal+GridSpacingVal; L2[sc.Index] = GridStartVal+GridSpacingVal*2; L3[sc.Index] = GridStartVal+GridSpacingVal*3; L4[sc.Index] = GridStartVal+GridSpacingVal*4; L5[sc.Index] = GridStartVal+GridSpacingVal*5; } |