Login Page - Create Account

Support Board


Date/Time: Sat, 01 Mar 2025 07:29:20 +0000



Post From: Volume By Price access to data

[2021-09-20 00:59:35]
ertrader - Posts: 681
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 - 187 views