Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 04:06:52 +0000



Post From: ACSIL Pitchfork code not working as expected

[2015-07-28 01:34:55]
Sierra Chart Engineering - Posts: 104368
Here is a good working example we put together:

SCSFExport scsf_UseToolExamplePitchfork(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Pitchfork";
    sc.StudyDescription = "";

    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0; //No automatic looping

    return;
  }

  // Pitchfork example
  s_UseTool Tool;
  //Tool.Clear();
  Tool.ChartNumber = sc.ChartNumber;
  Tool.DrawingType = DRAWING_PITCHFORK;
  int &LineNumber = sc.GetPersistentInt(1);
  if(LineNumber != 0)
    Tool.LineNumber = LineNumber;

  int BarIndex = max(0, sc.ArraySize - 50);

  //Beginning of middle line
  Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
  Tool.BeginValue = sc.Close[BarIndex];

  //Top line
  Tool.EndDateTime = sc.BaseDateTimeIn[BarIndex+10];
  Tool.EndValue = sc.High[BarIndex];

  //Bottom line
  Tool.ThirdDateTime = sc.BaseDateTimeIn[BarIndex+10];
  Tool.ThirdValue = sc.Low[BarIndex];

  Tool.Color = RGB(0,200,0);
  Tool.LineWidth = 2;
  Tool.RetracementLevels[0] = 100.0f;
  Tool.RetracementLevels[1] = -100.0f;
  Tool.RetracementLevels[2] = 150.0f;
  Tool.RetracementLevels[3] = -150.0f;
  Tool.LevelColor[2] = COLOR_YELLOW;
  Tool.LevelColor[3] = COLOR_MAGENTA;

  Tool.AddMethod = UTAM_ADD_OR_ADJUST;
  sc.UseTool(Tool);
  LineNumber = Tool.LineNumber;//Remember line number which has been automatically set
}

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
Date Time Of Last Edit: 2015-07-28 01:35:37