Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 04:02:40 +0000



ACSIL Pitchfork code not working as expected

View Count: 898

[2015-07-27 16:43:52]
swandro - Posts: 11
I am trying to draw a Pitchfork from ACSIL but it is not drawing the upper and lower lines, as shown in the chart image.

http://www.sierrachart.com/image.php?l=1438015103896.png

Here is the code I have written. Can you tell me what's wrong?

  s_UseTool Tool ;        
  Tool.Clear() ;
  Tool.ChartNumber = sc.ChartNumber ;
  Tool.DrawingType = DRAWING_PITCHFORK;
  Tool.LineNumber = 1039404905 ;
  Tool.BeginIndex = sc.Index-30;
  Tool.EndIndex = sc.Index-10 ;
  Tool.ThirdIndex = sc.Index-8 ;
  Tool.BeginValue = sc.High[sc.Index-30] ;
  Tool.EndValue = sc.High[sc.Index-10] ;
  Tool.ThirdValue = sc.Low[sc.Index-8] ;
  Tool.LineStyle = LINESTYLE_SOLID ;
  Tool.Color = CYAN;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST ;
  sc.UseTool(Tool) ;
[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
[2015-07-28 12:55:17]
swandro - Posts: 11
Support - thank you very much. Your example helped me immensely.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account