Login Page - Create Account

Support Board


Date/Time: Wed, 15 May 2024 19:58:13 +0000



Volume By Price access to data

View Count: 767

[2021-09-16 21:48:49]
ertrader - Posts: 648
What is the best way to get access to the Volume by Price (not volume at price) for the VpB study? The information I'm looking for is from the Chart values Window and the image is attached. Ideally, it would be available similar to how Numbers bars calculated values performs.

I did look through study ACSIL but only found Volume at price which is bar by bar.
imageScreenshot from 2021-09-16 17-38-07.png / V - Attached On 2021-09-16 21:48:30 UTC - Size: 44.79 KB - 162 views
[2021-09-16 23:27:43]
John - SC Support - Posts: 31659
Refer to the following:
Volume By Price Study: Accessing Volume by Price Calculated Values
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-09-17 01:33:08]
Sierra Chart Engineering - Posts: 104368
This information can be accessed through ACSIL. Refer to this function:
sc.GetStudyProfileInformation
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
Date Time Of Last Edit: 2021-09-17 01:33:21
[2021-09-19 21:34:36]
ertrader - Posts: 648
Success at last.... this version compiles and retains correct values. SC, can you please indicate if this is how you are expecting this function to be properly coded?

#include "sierrachart.h"

SCDLLName("VBPData")

SCSFExport scsf_VolumeByPriceData(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Volume       = sc.Subgraph[0];
  SCSubgraphRef Subgraph_BidVolume     = sc.Subgraph[1];
  SCSubgraphRef Subgraph_AskVolume     = sc.Subgraph[2];  

  SCInputRef INStudyID           = sc.Input[0];
  SCInputRef INProfileIndex        = sc.Input[1];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Volume By Price Data";
    sc.StudyDescription = "This obtains data from Volume By Price";
    sc.AutoLoop = true;
    sc.MaintainVolumeAtPriceData = 1; // true
    
    Subgraph_Volume.Name = "Volume";
    Subgraph_Volume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_Volume.LineWidth = 2;
    
    Subgraph_BidVolume.Name = "Bid Volume";
    Subgraph_BidVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_BidVolume.LineWidth = 2;

    Subgraph_AskVolume.Name = "Ask Volume";
    Subgraph_AskVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_AskVolume.LineWidth = 2;    

    INStudyID.Name="Study ID";
    INStudyID.SetInt(0);
    INStudyID.SetIntLimits(0,10000);    

    INProfileIndex.Name="Profile Index";
    INProfileIndex.SetInt(0);
    INProfileIndex.SetIntLimits(0,10000);      
    
    return;
  }

  // Do data processing
  const int StudyID             = INStudyID.GetInt();  
  const int ProfileIndex           = INProfileIndex.GetInt();  
  int Volume, BidVolume, AskVolume;
  
  n_ACSIL::s_StudyProfileInformation StudyProfileInformation;
  if(sc.GetStudyProfileInformation(StudyID, ProfileIndex, StudyProfileInformation))    
  {
    Volume = StudyProfileInformation.m_Volume;
    BidVolume = StudyProfileInformation.m_BidVolume;
    AskVolume = StudyProfileInformation.m_AskVolume;
    Subgraph_Volume[sc.Index] = Volume;
    Subgraph_BidVolume[sc.Index] = BidVolume;
    Subgraph_AskVolume[sc.Index] = AskVolume;    
  }  
}

Date Time Of Last Edit: 2021-09-19 21:40:42
[2021-09-19 22:13:57]
Sierra Chart Engineering - Posts: 104368
We definitely would not recommend using automatic looping in this case. Use manual looping. Refer to:
Working with ACSIL Arrays and Understanding Looping: Manual Looping/Iterating

It makes no sense to be calling this function repetitively, with the same parameters:
sc.GetStudyProfileInformation
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
Date Time Of Last Edit: 2021-09-19 22:14:26
[2021-09-19 22:38:15]
ertrader - Posts: 648
Oddly, manual looping had significantly worse performance. I will continue to do trial and error tests. Code available in one of the study.cpp files would be helpful.
Date Time Of Last Edit: 2021-09-19 22:44:59
[2021-09-19 23:06:14]
Sierra Chart Engineering - Posts: 104368
manual looping had significantly worse performance.
You must not be using it correctly. It is completely impossible to have worse performance.

This call must be outside of the loop in the manual loop function:
sc.GetStudyProfileInformation

It should only be called, when the study parameters, the first two, change.
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
Date Time Of Last Edit: 2021-09-19 23:06:38
[2021-09-20 00:58:23]
ertrader - Posts: 648
Manual looping:
#include "sierrachart.h"

SCDLLName("VBPData")

SCSFExport scsf_VolumeByPriceData(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Volume       = sc.Subgraph[0];
  SCSubgraphRef Subgraph_BidVolume     = sc.Subgraph[1];
  SCSubgraphRef Subgraph_AskVolume     = sc.Subgraph[2];  
  SCSubgraphRef Subgraph_DeltaVolume     = sc.Subgraph[3];  

  SCInputRef INStudyID           = sc.Input[0];
  SCInputRef INProfileIndex        = sc.Input[1];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Volume By Price Data";
    sc.StudyDescription = "This obtains data from Volume By Price";
    sc.AutoLoop = false;
    sc.MaintainVolumeAtPriceData = 1; // true
    
    Subgraph_Volume.Name = "Volume";
    Subgraph_Volume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_Volume.LineWidth = 2;
    
    Subgraph_BidVolume.Name = "Bid Volume";
    Subgraph_BidVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_BidVolume.LineWidth = 2;

    Subgraph_AskVolume.Name = "Ask Volume";
    Subgraph_AskVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_AskVolume.LineWidth = 2;    
    
    Subgraph_DeltaVolume.Name = "Delta Ask-Bid Volume";
    Subgraph_DeltaVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_DeltaVolume.LineWidth = 2;    

    INStudyID.Name="Study ID";
    INStudyID.SetInt(0);
    INStudyID.SetIntLimits(0,10000);    

    INProfileIndex.Name="Profile Index";
    INProfileIndex.SetInt(0);
    INProfileIndex.SetIntLimits(0,10000);      
    
    return;
  }

  // Do data processing
  const int StudyID             = INStudyID.GetInt();  
  const int ProfileIndex           = INProfileIndex.GetInt();  
  int Volume, BidVolume, AskVolume;


  n_ACSIL::s_StudyProfileInformation StudyProfileInformation;
  if(sc.GetStudyProfileInformation(StudyID, ProfileIndex, StudyProfileInformation))    
  {
    Volume = StudyProfileInformation.m_Volume;
    BidVolume = StudyProfileInformation.m_BidVolume;
    AskVolume = StudyProfileInformation.m_AskVolume;

  }  
  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; ++Index)
  {      
    Subgraph_Volume[Index] = Volume;
    Subgraph_BidVolume[Index] = BidVolume;
    Subgraph_AskVolume[Index] = AskVolume;      
    Subgraph_DeltaVolume[Index] = Subgraph_AskVolume[Index]-Subgraph_BidVolume[Index];
  }  
}

imageScreenshot from 2021-09-19 20-55-41.png / V - Attached On 2021-09-20 00:56:42 UTC - Size: 2.99 KB - 161 views
[2021-09-20 00:59:35]
ertrader - Posts: 648
Auto looping
#include "sierrachart.h"

SCDLLName("VBPData")

SCSFExport scsf_VolumeByPriceData(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Volume       = sc.Subgraph[0];
  SCSubgraphRef Subgraph_BidVolume     = sc.Subgraph[1];
  SCSubgraphRef Subgraph_AskVolume     = sc.Subgraph[2];  
  SCSubgraphRef Subgraph_DeltaVolume     = sc.Subgraph[3];  

  SCInputRef INStudyID           = sc.Input[0];
  SCInputRef INProfileIndex        = sc.Input[1];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Volume By Price Data";
    sc.StudyDescription = "This obtains data from Volume By Price";
    sc.AutoLoop = true;
    sc.MaintainVolumeAtPriceData = 1; // true
    
    Subgraph_Volume.Name = "Volume";
    Subgraph_Volume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_Volume.LineWidth = 2;
    
    Subgraph_BidVolume.Name = "Bid Volume";
    Subgraph_BidVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_BidVolume.LineWidth = 2;

    Subgraph_AskVolume.Name = "Ask Volume";
    Subgraph_AskVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_AskVolume.LineWidth = 2;    
    
    Subgraph_DeltaVolume.Name = "Delta Ask-Bid Volume";
    Subgraph_DeltaVolume.DrawStyle = DRAWSTYLE_IGNORE;
    Subgraph_DeltaVolume.LineWidth = 2;    

    INStudyID.Name="Study ID";
    INStudyID.SetInt(0);
    INStudyID.SetIntLimits(0,10000);    

    INProfileIndex.Name="Profile Index";
    INProfileIndex.SetInt(0);
    INProfileIndex.SetIntLimits(0,10000);      
    
    return;
  }

  // Do data processing
  const int StudyID             = INStudyID.GetInt();  
  const int ProfileIndex           = INProfileIndex.GetInt();  
  int Volume, BidVolume, AskVolume;


  n_ACSIL::s_StudyProfileInformation StudyProfileInformation;
  if(sc.GetStudyProfileInformation(StudyID, ProfileIndex, StudyProfileInformation))    
  {
    Volume = StudyProfileInformation.m_Volume;
    BidVolume = StudyProfileInformation.m_BidVolume;
    AskVolume = StudyProfileInformation.m_AskVolume;

  }  
//  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; ++Index)
//  {      
    Subgraph_Volume[sc.Index] = Volume;
    Subgraph_BidVolume[sc.Index] = BidVolume;
    Subgraph_AskVolume[sc.Index] = AskVolume;      
    Subgraph_DeltaVolume[sc.Index] = Subgraph_AskVolume[sc.Index]-Subgraph_BidVolume[sc.Index];
//  }  
}

Date Time Of Last Edit: 2021-09-20 01:01:32
imageScreenshot from 2021-09-19 20-59-11.png / V - Attached On 2021-09-20 00:59:25 UTC - Size: 3.02 KB - 143 views
[2021-09-20 01:00:21]
ertrader - Posts: 648
0 MS auto looping
12 MS Manual looping

Yes, I agree..this is odd!

In either case, I have it working as best I can so it's no problem.
Date Time Of Last Edit: 2021-09-20 01:03:03

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

Login

Login Page - Create Account