#include "sierrachart.h" SCDLLName("PercentageChange") /*==========================================================================*/ SCSFExport scsf_PercentageChange(SCStudyInterfaceRef sc) { SCSubgraphRef Plot1 = sc.Subgraph[0]; SCInputRef multiple = sc.Input[0]; SCInputRef inputselect = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "Percentage Change"; sc.AutoLoop = true; sc.FreeDLL = 0; Plot1.Name = "Percentage Change"; Plot1.LineWidth = 1; multiple.Name = "Multiplier"; multiple.SetInt(1); inputselect.Name = "Open/PriorClose Selection"; inputselect.SetCustomInputStrings("Open;PriorClose"); inputselect.SetCustomInputIndex(0); return; } // Do data processing if (sc.Index > 1) { if(inputselect.GetIndex() == 0) { Plot1[sc.Index] = ((sc.Close[sc.Index] - sc.Close[sc.Index-1])/sc.Close[sc.Index-1])*100*multiple.GetInt(); } else Plot1[sc.Index] = ((sc.Close[sc.Index] - sc.Open[sc.Index])/sc.Open[sc.Index])*100*multiple.GetInt(); } }