Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 06:49:28 +0000



[Programming Help] - Reading/Calculating "Valley" prices from VbP Study

View Count: 1004

[2017-02-28 14:41:08]
Sporken - Posts: 82
Hi,

In ACSIL, is it possible to get the price values of the Valleys from the "Volume By Price" study?
I've tried using Study/Price Overlays and Study Subgraph references and I've tried in ACSIL using sc.GetStudyArrayFromChartUsingID(), sc.ChartDrawingExists and GetUserDrawnChartDrawing().

I can't find the source for the Volume By Price study in the ACS sources folder. I think I probably need to write an ACSIL study to calculate these valley prices. Are there any examples I should look at? I see VAPContainer.h, is this the best place to start?

I am very happy to pay for your support with this as it obviously goes beyond the scope of a normal support issue.

Any assistance is greatly appreciated.
Kind Regards,
-Jason
[2017-02-28 17:26:50]
Sporken - Posts: 82
Hi,

I did some more searches of your support site and found the following section.

https://www.sierrachart.com/index.php?page=doc/VolumeByPrice.php#ProgrammaticallyAccessingVolumeAtPriceData

I think this is what I was looking for and unfortunately I think it says I'm not able to get those values from the study itself.
[2017-02-28 17:29:57]
Sporken - Posts: 82
This led me to this section which I am now reading

ACSIL Interface Members - Variables and Arrays: sc.VolumeAtPriceForBars
[2017-02-28 19:15:35]
Sierra Chart Engineering - Posts: 104368

In ACSIL, is it possible to get the price values of the Valleys from the "Volume By Price" study?

This data is not programmatically accessible. You will need to calculate this using this data:

ACSIL Interface Members - Variables and Arrays: sc.VolumeAtPriceForBars
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-06-20 12:50:50]
User978506 - Posts: 3
"This data is not programmatically accessible. You will need to calculate this using this data:"
Can you provide the code
[2023-06-20 12:59:45]
Sierra_Chart Engineering - Posts: 13625
Provide the code for what?
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[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;
  }
[2023-07-06 03:15:46]
Sierra_Chart Engineering - Posts: 13625
It is using this function which has a particular purpose:
sc.GetStudyPeakValleyLine

If this is all that you need, this is all that you need. It is that simple.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-07-06 03:15:58
[2023-07-07 07:43:49]
User407375 - Posts: 10
Dean, in case you didn't notice - when implementing this you will likely want a loop to increment the "PeakValleyIndex" argument to sc.GetStudyPeakValleyLine to extract all of the valleys. For example:

for (int i = 0; ; i++) {
if (sc.GetStudyPeakValleyLine(sc.ChartNumber, sc.Input[0].GetStudyID(0),
PeakValleyLinePrice, PeakValleyType, StartIndex, PeakValleyExtensionChartColumnEndIndex,
-1, i)) {
if (PeakValleyType == PEAKVALLEYTYPE_VALLEY) {
// Do whatever you want with PeakValleyLinePrice
}
} else
break;
}


Date Time Of Last Edit: 2023-07-07 10:54:10

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

Login

Login Page - Create Account