Support Board
Date/Time: Mon, 24 Feb 2025 18:29:14 +0000
Post From: Study: Max of a Range or Percentage of the Max of a Range
[2021-03-10 20:48:51] |
Flipper_2 - Posts: 57 |
Ok try this, #include "sierrachart.h" SCDLLName("HL Distance") SCSFExport scsf_HLDist(SCStudyInterfaceRef sc) { SCSubgraphRef HLRange = sc.Subgraph[0]; SCSubgraphRef RollingMax = sc.Subgraph[1]; SCInputRef Input_SubgraphRef = sc.Input[0]; SCInputRef HHLLPeriod = sc.Input[1]; // Section 1 - Set the configuration variables and defaults if (sc.SetDefaults) { sc.GraphName = "HL Distance"; sc.FreeDLL = 0; sc.AutoLoop = 1; //Automatic looping is enabled. sc.CalculationPrecedence = LOW_PREC_LEVEL; HLRange.Name = "HL_Range"; HLRange.DrawStyle = DRAWSTYLE_BAR; HLRange.PrimaryColor = RGB(0, 206, 206); HLRange.LineWidth = 2; RollingMax.Name = "RollingMax"; RollingMax.DrawStyle = DRAWSTYLE_IGNORE; RollingMax.PrimaryColor = RGB(0, 206, 0); Input_SubgraphRef.Name = "Subgraph Reference"; Input_SubgraphRef.SetStudySubgraphValues(0, 0); HHLLPeriod.Name = "Period for HH - LL calculation"; HHLLPeriod.SetInt(40); return; } SCFloatArray StudyRef; sc.GetStudyArrayUsingID(Input_SubgraphRef.GetStudyID(), Input_SubgraphRef.GetSubgraphIndex(), StudyRef); RollingMax[sc.Index] = sc.GetHighest(StudyRef, HHLLPeriod.GetInt()); HLRange[sc.Index] = RollingMax[sc.Index -1] / RollingMax[sc.Index]; } Date Time Of Last Edit: 2021-03-10 20:51:29
|