Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketDepth question

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

    OnMarketDepth question

    Hello guys,

    I have a question, which I could not find answer in documentation.
    I want to understand what is performed on Add/Update/Remove

    Here is simplified example, suppose we start from 0(or nothing) volume at position #1:

    1,Add(5) - at position 1 volume after is (5)
    1,Add(5) - at position 1 volume after is (10)
    1,Add(5) - at position 1 volume after is (15)
    1,Update(3) - at position 1 volume after is (3)??? or (18)??? or (13)??? or ???
    1,Remove(0) - at position 1 volume after(0)??? or (15)??? or ???


    *question if Update updates/edit last operation at #Position, or it is overrides whole #Position
    *and if Remove deletes last operation at #Position, or it is overrides(delete) whole #Position (reset to volume 0)
    *or there is some merging possible
    *and also question about operations orders, as I understand it can be only this order: Add/Update/Remove for one position number? Or?

    Thanks
    Last edited by login_dejavu; 08-05-2019, 08:00 AM.

    #2
    Hello login_dejavu,

    Thanks for your questions.

    Add would be used to create a price row in a level 2 book and add the current volume. Update would be used to update the volume at an existing price level. Remove would then remove that price level from the level 2 book.

    Position is used to index the position the price level resides in the level 2 book.

    It can be possible to see an Update before an Add depending on when the script starts, but this operation could be treated as an Add.

    I suggest using the SampleLevel2Book example to better visualize how OnMarketDepth can be used. I've included a link below.

    https://ninjatrader.com/support/help...vel_ii_dat.htm

    Please let us know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Ok, thanks for your response! But most of my questions was around what will happen with existing volume.

      Will 'Add/Update' add on top of existing value? or set/reset it to value in the event?
      Last edited by login_dejavu; 08-05-2019, 10:18 AM.

      Comment


        #4
        Hello login_dejavu,

        Add/Update will be used to set the volume to the current level, it would not be used for accumulation. You could test something like the following in the Update and Add blocks of the SampleLevel2Book example to visualize.

        Code:
                                ClearOutputWindow();
                                Print((e.MarketDataType == MarketDataType.Ask ? "Ask " : "Bid ") + "Volume: " + e.Volume + " Position: " + e.Position);
                                Print("Ask Book");
                                for (int idx = 0; idx < askRows.Count; idx++)
                                    Print("Ask Price=" + askRows[idx].Price + " Volume=" + askRows[idx].Volume + " Position=" + idx);
        
                                Print("Bid Book");
                                for (int idx = 0; idx < bidRows.Count; idx++)
                                    Print("Bid Price=" + bidRows[idx].Price + " Volume=" + bidRows[idx].Volume + " Position=" + idx);
        Let us know if there is anything else we can do to help.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks, you reply to my question!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by alifarahani, Today, 09:40 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by RookieTrader, Today, 09:37 AM
          4 responses
          18 views
          0 likes
          Last Post RookieTrader  
          Started by PaulMohn, Today, 12:36 PM
          0 responses
          5 views
          0 likes
          Last Post PaulMohn  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          40 views
          0 likes
          Last Post love2code2trade  
          Started by junkone, Today, 11:37 AM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X