Login Page - Create Account

Support Board


Date/Time: Sat, 10 May 2025 04:30:34 +0000



Post From: Finding the Highest Number from a Subgraph

[2015-10-22 20:35:12]
User126996 - Posts: 30
I'm trying to find the highest BidSize from the first 5 levels of the DOM. Here is my code. It won't seem to work.



SCSFExport scsf_DepthOfMarketData(SCStudyInterfaceRef sc)
{
SCSubgraphRef BidValue = sc.Subgraph[0];
SCSubgraphRef AskValue = sc.Subgraph[1];
SCSubgraphRef BidSize = sc.Subgraph[2];
SCSubgraphRef AskSize = sc.Subgraph[3];

SCSubgraphRef BigBid1 = sc.Subgraph[4];


if (sc.SetDefaults)
  {
sc.GraphName = "Depth of Market Data";
    sc.FreeDLL = 1;
    sc.StudyDescription = "This is a study to display current market depth data. When adding this study, also add the Spreadsheet study to your chart to view the market depth data in a table form on the spreadsheet.";
    sc.GraphRegion = 0;
    sc.UsesMarketDepthData = 1;
    sc.AutoLoop = 1;

BigBid1.Name = "BigBid1";
    BigBid1.DrawStyle = DRAWSTYLE_LINE;
    BigBid1.PrimaryColor = COLOR_HOTPINK;
    BigBid1.DrawZeros = false;

return;
  }

int& PriorIndex = sc.GetPersistentInt(1);

/**********************************************************************
Start - DOM Calculation
*/
for (int Level = 0; Level < 5; Level++)
  {
    if (sc.ArraySize - 1 - 5 < 0)
      brea
    BidSize[sc.ArraySize - 1 - Level] = (float)sc.SymbolData->BidDOM[Level].Volume;
    BidValue[sc.ArraySize - 1 - Level] = (float)sc.SymbolData->BidDOM[Level].Price;
    AskValue[sc.ArraySize - 1 - Level] = (float)sc.SymbolData->AskDOM[Level].Price;
    AskSize[sc.ArraySize - 1 - Level] = (float)sc.SymbolData->AskDOM[Level].Volume;

sc.Highest(BigBid1, BidSize, Level); // Find the Highest BidSize of the first 5 Levels

}
/* End - DOM Calculation
*****************************************************************************************************/


int LastIndex = sc.ArraySize - 1 - MAX_NUM_DOM_LEVELS;

  sc.EarliestUpdateSubgraphDataArrayIndex = LastIndex;

  if (PriorIndex < LastIndex)
  {
    for (int ClearIndex = LastIndex; ClearIndex >= PriorIndex; ClearIndex--)
    {
      
      BidValue[ClearIndex] = 0;
      AskValue[ClearIndex] = 0;
      BidSize[ClearIndex] = 0;

      

    }
  }


PriorIndex = (LastIndex >= 0) ? LastIndex : 0;



  
  
}


Any thoughts?