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 judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    55 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    35 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    19 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    7 views
    0 likes
    Last Post cre8able  
    Working...
    X