Login Page - Create Account

Support Board


Date/Time: Mon, 13 May 2024 16:10:58 +0000



Post From: Help - can't get my ACSIL code to draw Horizontal line

[2020-04-26 18:49:09]
JohnR - User831573 - Posts: 300
I have debugger the following code. Stepping through it with no errors. I do see values being assigned to the various parts of the structure. Just as a "skeleton test" I also see indicator values plotted correctly in 1st subchart. B u t --- no Horizontal line. I have tried it both ways, assigning a value to Tool.LineNumber and commenting that line of code out.

// The top of every source code file must include this line
#include "sierrachart.h"

// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.

SCDLLName("JOR_Skeleton_Template")

//This is the basic framework of a study function.

/*============================================================================
  This is a template function I use to test out a new functionaility by
  itself before trynig to add it to a more complete study
----------------------------------------------------------------------------*/

SCSFExport scsf_JOR_Skeleton(SCStudyGraphRef sc)
{

  // Set the configuration variables

  SCInputRef In_JOR_Buy_Line = sc.Input[0];

  // Set Names for persisten variables and type
  
  int& JOR_Test_Var = sc.GetPersistentInt(1);

  if (sc.SetDefaults)
  {
    sc.GraphName = "JOR Skeleton Template";
    sc.StudyDescription = "I use this as a test skeleton to learn how various things work.";

    sc.Input[0].Name = "In_JOR_Buy_Line";
    sc.Input[0].SetFloat(25.0f); // Set the default value to 20
    sc.Input[0].SetFloatLimits(5.0f, 99.0f); //Optional: Limit the range of this input to 1-1000

    sc.AutoLoop = 1; // true

    // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance.
    sc.FreeDLL = 1;

    sc.Subgraph[0].Name = "JOR_Skeleton";

    return;
  }

  // Data processing

  // On Index/Bar 1 draw a horizontal line

  if (sc.Index == 1) // I initially tried to use sc.Index == 0

  {
    // Use Drawing tool -> Horizontal line for Buy-Sell-50 Lines
    s_UseTool Tool;

    // Draw Buy Level horz line

    // Reset tool structure. It insures the structure you are about to use / fill, stats out blank with no left over data.
    Tool.Clear();

    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_HORIZONTALLINE;
//    Tool.LineNumber = int(In_JOR_Buy_Line.GetFloat());
    Tool.BeginValue = In_JOR_Buy_Line.GetFloat();
    Tool.LineWidth = 1;
    Tool.LineStyle = LINESTYLE_DASH;
    Tool.Color = RGB(17, 255, 57);
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    sc.UseTool(Tool);
  }

  if (sc.Index == 0) JOR_Test_Var = 1;
  if (JOR_Test_Var > 99) JOR_Test_Var = 1;

  // Just plotting a value between 1 and 99 to see that the code is executing
  sc.Subgraph[0][sc.Index] = float(JOR_Test_Var);
  JOR_Test_Var++;
}
Date Time Of Last Edit: 2020-04-26 21:07:50