Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 15:05:38 +0000



Post From: Reading/Calculating "Valley" prices from VbP Study

[2023-07-05 22:25:33]
Dean Roberts - Posts: 79
I'm trying to get Valley values from a Volume Profile as well and trying to create a custom study using the function below from the studies2.cpp file. The below function negates the use of the sc.volumeatpriceforbars function doesn't it?

  sc.GetStudyPeakValleyLine example function
----------------------------------------------------------------------------*/
SCSFExport scsf_GetStudyPeakValleyLineExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "GetStudyPeakValleyLine Example";

    sc.AutoLoop = 0;

    sc.Input[0].SetStudyID(1);
    sc.Input[0].Name = "Volume by Price Study";

    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(0), PeakValleyLinePrice, PeakValleyType, StartIndex, PeakValleyExtensionChartColumnEndIndex, -1, 0))
  {
    // Peak/Valley line found
    int Test = 1;
  }