Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData ASK BID price and volume

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

    OnMarketData ASK BID price and volume

    I trade futures, focused on ZN instrument at moment. I am working on an indicator/data-monitor of ASK BID movement of price, volume/traded and ask-bid volume/size. I am currently making use of OnMarketData starting with the following example code from the userguide:

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    // Print some data to the Output window
    if (e.MarketDataType == MarketDataType.Last)
    Print("Last = " + e.Price + " " + e.Volume);

    else if (e.MarketDataType == MarketDataType.Ask)
    Print("Ask = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Bid)
    Print("Bid = " + e.Price + " " + e.Volume);
    }



    While running this live I noticed e.Price values when e.MarketDataType was Ask or Bid having values not equal to the current Ask Bid values as seen in the T&S window. I was expecting these price values to be the same and therefore assumed e.Volume of one the event as representative of the Ask Volume/Size or Bid Volume/Size. Based on my observation of e.Price values not equal to the current Ask or Bid price, it appears I do not have a good understanding of what data comes from OnMarketData invocations.

    What is the structure/relationship of OnMarketData e.Price and e.Volume for Ask and Bid events with resect to the T&S Bid, Ask price and volume/size?

    I believe OnMarketDepth returns e.price where there is a change in volume/size at the respective price level (at or above the ask or at or below the bid) and would expect e.price values not equal to the current ask bid price on these invocations.


    Where can I get a better description or understanding of e.Price and e.Volume values with respect to the market action for both OnMarketData and OnMarketDepth?


    I also noticed during live trading with OnMarketData, I only received Ask and Bid events, no other events appeared over the hour I watched it closely (no Last events). Is this to be expected?


    My provider is AMP using CQG
    Last edited by tulanch; 10-10-2014, 03:42 PM.

    #2
    Your understanding of OnMarketData is correct. e.Price and e.Volume would give you the same values we use in the T&S, as long as we're talking about the ask/bid volume in the price panel. The "tape" portion of the Time and Sales is last events only, so if perhaps you were looking at the Ask/Bid event volumes and comparing that to what is on the tape, they would not match. If however you were looking at the advertised volume on the actual price panel of the T&S, then the your post does not make much sense as you seem to understand these event methods quite well, which leads me to believe there must be something else going on.

    In addition, I would not expect to only get ask/bid updates, there should have been several others sent from your data provider as per the list in our help guide. At the very least I'd expect ask, bid, last, and daily volume to be processed within an hour.

    We do not have any additional documentation on these events other than what is in our help guide, however perhaps if you watch our "Level 2" window, you may be able to get a better picture of what's going on as this window uses both OnMarketDepth and OnMarketData events to display various values.

    If that does not clear anything up, please try this on another market such as the ES and let me know if the results still do not add up. At any rate, please post your findings and I'll be happy to take a look at this Monday morning based on your findings.
    MatthewNinjaTrader Product Management

    Comment


      #3
      issue was e.Price.....

      one quick clarifying point

      In my hour review, I saw e.Price from an ASK or BID event in OnMarketData that causes the confusion. From an ASK event, I saw e.Price above the current Ask Price listed in the T&S window (top portion). I also saw BID events where e.Price was below the Bid Price in the T&S window.

      I did not expect to see this as the T&S Ask and Bid prices listed in the T&S window did not change during this time, they remained constant.

      I would think that the Ask and or Bid price would need to change for OnMarketData Ask or Bid events to have e.Price values not equal to the current T&S listed Ask and Bid Price.

      Could this be timing related, meaning the market is moving faster than the ability to get the data to my client and to update the data as required on the T&S window?

      Can you please clarify this point for me.

      Comment


        #4
        Originally posted by tulanch View Post
        one quick clarifying point

        In my hour review, I saw e.Price from an ASK or BID event in OnMarketData that causes the confusion. From an ASK event, I saw e.Price above the current Ask Price listed in the T&S window (top portion). I also saw BID events where e.Price was below the Bid Price in the T&S window.

        I did not expect to see this as the T&S Ask and Bid prices listed in the T&S window did not change during this time, they remained constant.

        I would think that the Ask and or Bid price would need to change for OnMarketData Ask or Bid events to have e.Price values not equal to the current T&S listed Ask and Bid Price.

        Could this be timing related, meaning the market is moving faster than the ability to get the data to my client and to update the data as required on the T&S window?

        Can you please clarify this point for me.
        Hi tulanch,

        T&S window should only match (e.MarketDataType == MarketDataType.Last) for e.Price and e.Volume.

        (e.MarketDataType == MarketDataType.Ask) and (e.MarketDataType == MarketDataType.Bid) are updates to resting limit orders in the level 1 book and will not show up in the T&S window. This explains the price differences you observed.

        Hope this helps,

        RJay
        RJay
        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

        Comment


          #5
          Thanks for the clarification. I belive I now understand where my confusion is/was. I had the idea OnMarketData would only show trades/events at or between the current Ask and Bid, inclusively. I now understand that OnMarketData(level 1 data) and OnMarketDepth(level 2 data) process similar market events and OnMarketDepth provides more detail about the event (level 2 data). Meaning, for example, the addtion of a limit order above the ask, to the "book", will cause an event to be passed to both OnMarketData and OnMarketDepth for processing.

          I wll continue my review to see why I am not seeing LAST events using OnMarketData.

          Comment


            #6
            I found the issue - EBKAC error (Error Between Keyboard And Chair) I thought I had overwritten OnMarketData, but in fact I was still using OnMarketDepth which is why no LAST events. (too much testing, updating, etc...)

            I want to also clarify my previous report for future readers - since changing to OnMarketData as it should have been in the first place, the e.Price with a ASK or BID event appears to match the T&S window Ask and Bid price values and does not go above or below the T&S values. I am also getting LAST and DAILYVOLUME events as expected.

            Also daily volume is the value seen in the T&S upper window and gets updated with every LAST
            Last edited by tulanch; 10-14-2014, 02:49 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by funk10101, Today, 09:43 PM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            24 views
            0 likes
            Last Post algospoke  
            Working...
            X