Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 16:09:46 +0000



Post From: Volume by Price - Valleys and Peak data not on spreadsheet

[2020-10-30 18:53:57]
User355030 - Posts: 163
Here is my code, builds but cant get the lines on chart

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

// For reference, refer to this page:
// Advanced Custom Study Interface and Language (ACSIL)
#include "sierrachart.h"

// For reference, refer to this page:
// Advanced Custom Study Interface and Language (ACSIL)

// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.
SCDLLName("VBP Valley Lines KI")

//This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require.
SCSFExport scsf_GetStudyPeakValleyLineExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "GetStudyPeakValleyLine Example";
    sc.Subgraph[0].Name = "VBPVALLEYKI";
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;

    sc.AutoLoop = 0;

    sc.Input[0].SetStudyID(1);

    sc.Input[0].Name = "Peak Valley Test";

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

    sc.Subgraph[0].PrimaryColor = RGB(0, 255, 0);

    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;

    sc.Subgraph[1].Name = "Line2";

    sc.Subgraph[1].PrimaryColor = RGB(255, 255, 0);

    sc.Subgraph[1].DrawStyle = DRAWSTYLE_LINE;

    return;
  }


  // Do data processing
  float PeakValleyLinePrice= 0;
  int PeakValleyType = 0;
  int StartIndex = 0;
  int PeakValleyExtensionChartColumnEndIndex = 0;

  // get the first Peak/Valley line from the last volume by price profile
  if (sc.GetStudyPeakValleyLine(sc.ChartNumber, sc.Input[0].GetStudyID(), PeakValleyLinePrice, PeakValleyType, StartIndex, PeakValleyExtensionChartColumnEndIndex, -1, 0))
  {
    // Peak/Valley line found
    int Test = 1;
  }
}