Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Understanding the OnMarketDepth() ladder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Understanding the OnMarketDepth() ladder

    Hi,

    I need some help understanding the information that the OnMarketDepth() event gives me, specifically the ladder.

    To make things easier I'd like to use the Emini as an example with a tick size of 0.25.

    #1: What is the base for the zero-based index?
    If the current best ASK is 1234.50 would this be the ladder position '0' for the ASK part of the ladder?
    Or is the base the LAST traded price (so the price for position '0' is identical for the BID and ASK ladders)?

    #2: What is the price for position '1' then?
    Is it always 1234.75 (the next possible price one tick higher)?
    Or is it the next higher price that has a sitting order volume larger than zero?

    #3: I understand that NT shows only 10 levels of the ladder. If the best ASK moves higher by 1 tick (0.25) when will I know what volume is sitting at the new 10th rung of the ladder (position '9')?
    Will OnMarketDepth() be triggered immediately with INSERT at position '9' and the currently active order volume?
    Or will there need to be a change in order volume at position '9' before OnMarketDepth() gets triggered (returning an INSERT for position '9')?
    FYI: I am using Kinetick.

    Thanks in advance,
    Thrakkar

    #2
    Hello Nutflush, and thank you for your question.

    OnMarketDepth in both NT7 and NT8 is an event handler which takes one argument, and that is an object that holds current level 2 data. This is documented in NT7 and NT8, respectively, here :

    http://ninjatrader.com/support/helpG...heventargs.htm
    http://ninjatrader.com/support/helpG...heventargs.htm

    All data being passed into OnMarketDepth is at a zero based index in a sense; if you want previous series data, you will want to store this data between calls to OnMarketDepth yourself, or rely on old e.g. Ask data. To print the most recent e.g. Ask data, you could use code such as the following :

    Code:
    private double mostRecentAsk;
    
    protected override void OnMarketDepth(MarketDepthEventArgs marketDepthUpdate)
    {
        // Print some data to the Output window
        if (marketDepthUpdate.MarketDataType == MarketDataType.Ask && marketDepthUpdate.Operation == Operation.Update)
        {
            mostRecentAsk = marketDepthUpdate.Price;
        }
    
        Print(string.Format("The most recent ask price is {0}", mostRecentAsk));}
    Given that OnMarketDepth is an event handler, I am not really certain I understand the relationship between it and the ladder you are referring to. If I was unable to resolve yourr query, could you please clarify? Please also do not hesitate if there is any other way I can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi Jessica,

      I already knew these two links. That's exactly what I am refering to in my questions which are related with the info passed on by the event handler in the object 'marketDepthUpdate'.

      For example 'marketDepthUpdate.Position' is a "value representing the zero based position in the depth ladder" (as per defintion in one of your links).

      Does that make my questions clear now? I try to understand how to interpret the information returned by the event handler in that object.

      Comment


        #4
        Hello NutFlush,

        Thank you for clarifying. I ran the attached indicator which prints out tick-by-tick updates on Level 2 data, next to a SuperDOM, and I was able to determine that Position 0 is the first bid or ask position. For instance, if marketDepthUpdate.MarketDataType == MarketDataType.Ask , and marketDepthUpdate.Position was 3, then we would be talking about the 3rd tick below the currently traded price.

        Please let us know if there are any other ways we can help.
        Attached Files
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by daniel_weber8, Today, 01:21 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by jungsoohuh, Today, 12:07 PM
        1 response
        23 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by SharonSS, Today, 11:54 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by crystalet, Today, 11:20 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by SuperDude123, Today, 09:23 AM
        1 response
        34 views
        0 likes
        Last Post NinjaTrader_JustinD  
        Working...
        X