Support Board
Date/Time: Fri, 14 Mar 2025 04:33:11 +0000
[Programming Help] - GetStudyPeakValleyLineExample help
View Count: 402
[2022-06-11 18:31:19] |
C_Money - Posts: 77 |
Hello, So I understand that I can't access SG18 and SG19 from the VbP study without using another study to reference it. So I'm looking at the GetStudyPeakValleyLineExample function in Studies2.cpp and I'm a little confused, and also not a great programmer, just some light scripting. I understand that if the if statement returns true, then Test = 1. But that statement looks for a specific profile in the index and a specific peak/valley. But what if I don't really care about the profile index and just want the peaks and valleys? I'm only really looking to create alerts based on price crossing over any peak/valley in the entire chart. How would I modify the function to do that? 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(), PeakValleyLinePrice, PeakValleyType, StartIndex, PeakValleyExtensionChartColumnEndIndex, -1, 0)) { // Peak/Valley line found int Test = 1; } } |
To post a message in this thread, you need to log in with your Sierra Chart account: