Login Page - Create Account

Support Board


Date/Time: Sat, 29 Aug 2026 05:03:56 +0000



Post From: GetBid/AskMarketLimitOrdersForPrice returns zero in standalone Trade DOM

[2026-07-21 05:00:57]
Sierra_Chart Engineering - Posts: 24699
We do not see any problems with this. Here is a code example:

SCSFExport scsf_MarketLimitOrdersForPriceExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "MarketLimitOrdersForPrice Example";

    sc.UsesMarketDepthData = 1;

    sc.AutoLoop = 0;

    sc.GraphRegion = 0;

    return;
  }

  if (sc.ServerConnectionState != SCS_CONNECTED)
    return;

  // Do data processing
  int BidNumLevels = sc.GetBidMarketDepthNumberOfLevels();
  int AskNumLevels = sc.GetAskMarketDepthNumberOfLevels();

  const int NumberOfMarketOrderDataElements = 20;
  n_ACSIL::s_MarketOrderData MarketOrderData[NumberOfMarketOrderDataElements] = {};

  if (BidNumLevels > 5)
  {
    BidNumLevels = 5;
  }
  if (AskNumLevels > 5)
  {
    AskNumLevels = 5;
  }
    
  for (int LevelIndex = 0; LevelIndex < BidNumLevels; LevelIndex++)
  {
    s_MarketDepthEntry MarketDepthEntry;
    sc.GetBidMarketDepthEntryAtLevel(MarketDepthEntry, LevelIndex);

    int ActualLevels = sc.GetBidMarketLimitOrdersForPrice(sc.Round(MarketDepthEntry.AdjustedPrice / sc.TickSize), NumberOfMarketOrderDataElements, MarketOrderData);

    for (int OrderDataIndex = 0; OrderDataIndex < ActualLevels; OrderDataIndex++)
    {
      uint64_t OrderID = MarketOrderData[OrderDataIndex].OrderID;
      t_MarketDataQuantity MarketDataQuantity = MarketOrderData[OrderDataIndex].OrderQuantity;
      
      if(OrderDataIndex < 1)
      {
        SCString LogString;
        LogString.Format("Bid Limit order | Price:%f, Quantity:%f, OrderId:%llu", MarketDepthEntry.AdjustedPrice, MarketDataQuantity, OrderID);
        sc.AddMessageToLog(LogString, false);
      }
    }

  }

  for (int LevelIndex = 0; LevelIndex < AskNumLevels; LevelIndex++)
  {
    s_MarketDepthEntry MarketDepthEntry;
    sc.GetAskMarketDepthEntryAtLevel(MarketDepthEntry, LevelIndex);

    int ActualLevels = sc.GetAskMarketLimitOrdersForPrice(sc.Round(MarketDepthEntry.AdjustedPrice / sc.TickSize), NumberOfMarketOrderDataElements, MarketOrderData);

    for (int OrderDataIndex = 0; OrderDataIndex < ActualLevels; OrderDataIndex++)
    {
      uint64_t OrderID = MarketOrderData[OrderDataIndex].OrderID;
      t_MarketDataQuantity MarketDataQuantity = MarketOrderData[OrderDataIndex].OrderQuantity;

      if(OrderDataIndex < 1)
      {
        SCString LogString;
        LogString.Format("Ask Limit order | Price:%f, Quantity:%f, OrderId:%llu", MarketDepthEntry.AdjustedPrice, MarketDataQuantity, OrderID);
        sc.AddMessageToLog(LogString, false);
      }
    }

  }

}

When using the above study on a Chart or Trade DOM, we recommend setting the chart update interval to about 2000 to 5000 ms. So the Message Log does not fill with too many messages too quickly.

We also see you are running older versions of Sierra Chart. It is essential to update and may resolve the problem. Instructions:

Software Download: Fast Update
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: 2026-07-21 05:01:57