Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 02:11:18 +0000



Post From: forecast oscillator

[2016-02-17 19:55:19]
Sierra Chart Engineering - Posts: 104368
Here is the source code for it:

SCSFExport scsf_ForecastOscillator(SCStudyInterfaceRef sc)
{
  SCSubgraphRef ForecastOscillator = sc.Subgraph[0];
  SCSubgraphRef ZeroLine = sc.Subgraph[1];

  SCFloatArrayRef Avg = ForecastOscillator.Arrays[0];

  SCInputRef InputData = sc.Input[0];
  SCInputRef Period = sc.Input[1];


  if (sc.SetDefaults)
  {
    sc.GraphName = "Forecast Oscillator";

    sc.ValueFormat = 2;
    sc.DrawZeros = 1;
    sc.AutoLoop = 1;
sc.FreeDLL = 0;
    
    // subgraphs
    ForecastOscillator.Name = "Relative Volume";
    ForecastOscillator.DrawStyle = DRAWSTYLE_LINE;
    ForecastOscillator.PrimaryColor = COLOR_GREEN;
    ForecastOscillator.LineWidth = 2;

    ZeroLine.Name = "Zero";
    ZeroLine.DrawStyle = DRAWSTYLE_LINE;
    ZeroLine.LineStyle = LINESTYLE_DOT;
    ZeroLine.PrimaryColor = COLOR_DARKGRAY;
    ZeroLine.DisplayNameValueInWindowsFlags = 0;

    // inputs
    InputData.Name = "Input Data";
    InputData.SetInputDataIndex(SC_LAST);

    Period.Name = "Period";
    Period.SetInt(14);
    Period.SetIntLimits(1, MAX_STUDY_LENGTH);

    return;
  }

  SCFloatArrayRef BaseDataArray = sc.BaseDataIn[InputData.GetInputDataIndex()];

  sc.LinearRegressionIndicator(BaseDataArray, Avg, Period.GetInt());

  float InputValue = BaseDataArray[sc.Index];

  if (InputValue != 0)
    ForecastOscillator[sc.Index] = 100.0f * ((InputValue - Avg[sc.Index]) / InputValue);

  ZeroLine[sc.Index] = 0.0f;
}

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing