Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 18:28:06 +0000



GetBidMarketLimitOrdersForPrice

View Count: 1386

[2021-02-26 20:25:35]
User566913 - Posts: 39
I'm really stuck here. How do you set this up in code? Is there a reference anywhere, thanks?
....
int GetAskMarketLimitOrdersForPrice(const int PriceInTicks, const int ArraySize, n_ACSIL::s_MarketOrderData* p_MarketOrderDataArray);
....
[2021-02-26 23:34:17]
Sierra Chart Engineering - Posts: 104368
We will put together a code example.
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
[2021-02-28 05:23:29]
User566913 - Posts: 39
Big thanks Sierra Chart Engineering!
[2021-03-01 22:57:37]
Sierra Chart Engineering - Posts: 104368
Here is an example we put together but it has not been tested :
/*============================================================================
  
----------------------------------------------------------------------------*/
SCSFExport scsf_MarketLimitOrdersForPriceExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "MarketLimitOrdersForPrice Example";

    sc.AutoLoop = 0;
    return;
  }


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

  const int NumberOfMarketOrderDataElements = 20;
  n_ACSIL::s_MarketOrderData MarketOrderData[NumberOfMarketOrderDataElements];
    
  for (int LevelIndex = 0; LevelIndex < BidNumLevels; LevelIndex++)
  {
    s_MarketDepthEntry MarketDepthEntry;
    sc.GetBidMarketDepthEntryAtLevel(MarketDepthEntry, LevelIndex);

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

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

  }

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

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

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

  }

}

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
[2021-03-02 17:55:08]
User566913 - Posts: 39
It works. I just don't know what I'm doing with it yet, lol.. I made a test trading algo using ActualLevels. It trades, but I still don't understand the logic in the code. I'm working on it, but I'm grateful to Sierra Charts Engineering, Kam2000, and User907968...
[2021-03-02 23:05:30]
Sierra Chart Engineering - Posts: 104368
We are also now documenting these functions.
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
[2021-03-02 23:27:52]
User566913 - Posts: 39
Nice, please respond back when it's updated. Thanks so much
[2021-03-03 19:43:24]
User566913 - Posts: 39
For an example to use this function, refer to the scsf_MarketLimitOrdersForPriceExample study function in the /ACS_Source/Studies2.cpp file in the Sierra Chart installation folder.
.....
I cannot find it in there. I've collapsed all the examples...
...
[2021-03-03 21:02:48]
kam2001 - Posts: 65
Don't think it's there yet as Sierra Chart Engineer's just wrote this example code and it may be added to Studies2.cpp in next release.
[2021-03-04 22:58:35]
Sierra Chart Engineering - Posts: 104368
This is in prerelease 2235. Also the documentation has been updated.
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
[2021-05-28 13:19:30]
ejtrader - Posts: 688
SC Team - As the full MBO data is not provided for the orders(at present it is 4 and above for MBO) - would it be possible to include the field - "Actual Number of orders" - Number of Standing Orders for each price?

For example:
Let's say Total size of the order is 20 - 4,4,3,2,7 - At present MBO displays - 4,4,7. Would it be possible to provide the total number of orders as 5 (though the MBO data doesn't display 3,2 at present) as well as a function (if it doesn't exist already).

Thanks
Date Time Of Last Edit: 2021-05-28 13:20:30
[2021-05-28 13:29:27]
User907968 - Posts: 800
Already possible via
sc.GetAskMarketDepthEntryAtLevel
&
sc.GetBidMarketDepthEntryAtLevel

Returns struct below with number of orders at price level


struct s_MarketDepthEntry
{
float Price;
t_MarketDataQuantity Quantity;
uint32_t NumOrders;
}

[2022-02-13 23:18:23]
kav24 - Posts: 11
Hi , I am seeing the ActualLevels as zero when I tried to print them . I have Service Package 12 - Advanced MBO + Denali Data Feed . Please help





  const int NumberOfMarketOrderDataElements = 20;
  n_ACSIL::s_MarketOrderData MarketOrderData[NumberOfMarketOrderDataElements];
  int& PriorIndex = sc.GetPersistentInt(1);

  int MaximumMarketDepthLevels = sc.GetMaximumMarketDepthLevels();

  if (MaximumMarketDepthLevels > sc.ArraySize)
    MaximumMarketDepthLevels = sc.ArraySize;

  int BidArrayLevels = min(MaximumMarketDepthLevels, sc.GetBidMarketDepthNumberOfLevels());
  
  unsigned int a,b;
  for (int Level = 0; Level < BidArrayLevels; Level++)
  {

    s_MarketDepthEntry DepthEntry;
    sc.GetBidMarketDepthEntryAtLevel(DepthEntry, Level);



    SCString TestString;
    int ActualLevels = sc.GetBidMarketLimitOrdersForPrice(sc.Round(DepthEntry.Price / sc.TickSize), NumberOfMarketOrderDataElements, MarketOrderData);

    TestString.Format("ActualLevels = %d,%d,%f", ActualLevels, DepthEntry.Price, sc.TickSize);
    LogTextBid += TestString + "\t";



2)Cant we get the order id from Time and sales data ?
Date Time Of Last Edit: 2022-02-13 23:32:35
[2022-02-14 00:04:49]
1+1=10 - Posts: 270
2)Cant we get the order id from Time and sales data ?

No, the s_TimeAndSales structure in "ACS_Source\scstructures.h" only has following fields. I don't have MBO data so I can't contribute to question 1. Good luck.


struct s_TimeAndSales
{
  SCDateTimeMS DateTime;
  float Price;
  uint32_t Volume;
  float Bid;
  float Ask;
  uint32_t BidSize;
  uint32_t AskSize;

  //This will always be a value >= 1. It is unlikely to wrap around, but it could. It will never be 0.
  uint32_t Sequence;

  int16_t UnbundledTradeIndicator;
  int16_t Type;
  uint32_t TotalBidDepth;
  uint32_t TotalAskDepth;

}

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

Login

Login Page - Create Account