Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 10:55:21 +0000



[Programming Help] - scsf_GetStudyPeakValleyLineExample Code Not Working For Me

View Count: 281

[2023-11-30 17:20:53]
maxpi - Posts: 181
Following is a study I made to test the code in scsf_GetStudyPeakValleyLineExample. The goal is to print out to the log if the function returns anything and it never does. I tried user drawn profile and the profile study, tried different inputs to sc.GetStudyPeakValleyLine and nothing, ever...






SCSFExport scsf_TestPeakValley(SCStudyInterfaceRef sc)
{
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "Test Peak Valley";
    sc.AutoLoop = 1; //Automatic looping is enabled.
    sc.MaintainVolumeAtPriceData = 1;
    
    sc.Input[0].SetStudyID(1);
    sc.Input[0].Name = "Volume by Price Study";
    
    return;
  }
  SCString MessageText;
  
  // 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;
    
    MessageText.Format("Test %i", Test);
    sc.AddMessageToLog(MessageText, 0);
  }
}
[2023-12-04 16:48:35]
maxpi - Posts: 181
This still is not working for me... does the "index" value tranferred to the function apply to VBP or Numbers Bars?
Date Time Of Last Edit: 2023-12-04 17:56:45
[2023-12-06 00:34:28]
maxpi - Posts: 181
I can use the function that gets a structure with data from a profile and have a working study, it works fine today in fact, but the sc.GetStudyPeakValleyLine is beyond my reach. It would be the simpler answer for what I want to do.
[2023-12-06 09:22:32]
User431178 - Posts: 543
Silly question, but did you already enable the peak and valleys in the VBP study?
[2023-12-06 13:03:12]
maxpi - Posts: 181
I believe you've done it now.. Had to go into vbp settings and enable drawing peak/valleys. Who'da thought...

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

Login

Login Page - Create Account