Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Depth Issues

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

    Market Depth Issues

    Hello all,

    I am currently trying to access the Level 2 Data by each ladder position.

    I.E --> I would like to print the Price and the Volume of Bid Ladder Position 0. I am looking to do this with futures contracts in particular (in case that changes anything).

    I have seen other posts on the forum saying to add

    Code:
    //Define instrument to be "ES ##-##" for example
    MarketDepth marketDepth = new MarketDepth<MarketDepthRow>(instrument);
    marketDepth.Update += OnMarketDepth;
    ISSUE: OnMarketDepth takes an argument which is an eventHandler. Therefore, I get a compilation error saying there is no overloaded method for 0 arguments.

    I HAVE ALSO TRIED

    Code:
    else if(State == State.Configured){
         //Define instrument to be "ES ##-##" for example
         MarketDepth marketDepth = new MarketDepth<MarketDepthRow>(instrument);
    }
    
    OnBarUpdate(){
         Print(marketDepth.Asks[0].Volume);
    }
    Where I get "Accessing an index that is not defined I.E accessing bar 5 when only 4 bars are available."

    If somebody can help me that would be greatly appreciated. It seems as if the documentation is a little outdated by the first suggestion.

    Thank you.

    Z

    #2
    Hello Z,

    Thank you for your post.

    MarketDepth needs to be assigned from OnMarketDepth(): http://ninjatrader.com/support/helpG...arketdepth.htm

    You cannot call MarketDepth to assign values from other methods. Essentially, your MarketDepth variable needs to get it's value in the OnMarketDepth() function.

    Please refer to our reference samples below for more details:
    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    61 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    39 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    21 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    23 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    51 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X