Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 17:55:53 +0000



Post From: ACSIL Volume By Price

[2023-07-28 13:06:03]
JohnR - User831573 - Posts: 306
J,

I believe the source to that is not available. But, there is source and some docs that shows how to access the B/A volumes at each price level, I used this as a starting point to create custom code.

Programmatically Accessing Volume at Price Data
Volume By Price Study: Programmatically Accessing Volume at Price Data

Then in Studies8.cpp there is an example that accesses the arrays of B/A members at each level


/*=====================================================================
  Volume At Price array test.
----------------------------------------------------------------------------*/
SCSFExport scsf_VolumeAtPriceArrayTest(SCStudyInterfaceRef sc)

Below is some of my code


  s_VolumeAtPriceV2* p_VolumeAtPrice = nullptr;
  int JOR_BarHighBidVol = 0;
  int JOR_BarLowBidVol = 0;
  int JOR_BarHighAskVol = 0;
  int JOR_BarLowAskVol = 0;


  // Now get the Bid & Ask Trade Volumes for the High and Low of the bar
  
  // Get the # of price levels - remember array start @ zero - so subtract 1 from count
  int JOR_BarPriceLevels = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(sc.Index) - 1;

  // zero array is lowest price level
  if (!sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, 0, &p_VolumeAtPrice))
    return;
  JOR_BarLowBidVol = p_VolumeAtPrice->BidVolume;
  JOR_BarLowAskVol = p_VolumeAtPrice->AskVolume;
  
  // Highest price level in last array element
  if (!sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, JOR_BarPriceLevels, &p_VolumeAtPrice))
    return;
  JOR_BarHighBidVol = p_VolumeAtPrice->BidVolume;
  JOR_BarHighAskVol = p_VolumeAtPrice->AskVolume;

Hope this helps,
JohnR
Date Time Of Last Edit: 2023-07-28 13:36:07