#include "sierrachart.h" SCDLLName("RotationFactor") /*==========================================================================*/ SCSFExport scsf_RotationFactor(SCStudyInterfaceRef sc) { SCSubgraphRef Total = sc.Subgraph[0]; SCSubgraphRef Top = sc.Subgraph[10]; SCSubgraphRef Bot = sc.Subgraph[11]; SCSubgraphRef TopSum = sc.Subgraph[12]; SCSubgraphRef BotSum = sc.Subgraph[13]; SCInputRef period1 = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "Rotation Factor"; sc.AutoLoop = true; sc.FreeDLL = 0; Total.Name = "Rotation Factor"; Total.LineWidth = 1; period1.Name = "Summation Period"; period1.SetInt(14); return; } // Do data processing if (sc.Index > period1.GetInt()) { Top[sc.Index] = sc.High[sc.Index] > sc.High[sc.Index-1] ? 1 : sc.High[sc.Index] < sc.High[sc.Index-1] ? -1 : 0; Bot[sc.Index] = sc.Low[sc.Index] < sc.Low[sc.Index-1] ? -1 : sc.Low[sc.Index] > sc.Low[sc.Index-1] ? 1 : 0; sc.Summation(Top, TopSum, period1.GetInt()); sc.Summation(Bot, BotSum, period1.GetInt()); Total[sc.Index] = TopSum[sc.Index] + BotSum[sc.Index]; } }