Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions about MarketDataEventArgs

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

    Questions about MarketDataEventArgs

    OK. IB is too slow to download. I will use some workaround on this.

    I just had another question regarding MarketDataEventArgs. There is Price and Last, same as Bid, Ask. This 'Last' is not MarketDataType.Last, and it is not documented here: https://ninjatrader.com/support/help...aeventargs.htm. What is it? Samilar question regarding Data Box. What is 'Price'? besides OHLC.

    #2
    Hello cliffhu,

    Thank you for your post.

    This question has been split into another thread since it was unrelated to your previous inquiry.

    There is Price and Last, same as Bid, Ask. This 'Last' is not MarketDataType.Last, and it is not documented here
    What "price and last" are you referring to?

    To get Last price updates from OnMarketData, you could do the following:

    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    // Check if the update is a Last update
    if (marketDataUpdate.MarketDataType == MarketDataType.Last)
    //If it is a last update, print the price
    Print("Last = " + marketDataUpdate.Price);
    }

    ? Samilar question regarding Data Box. What is 'Price'?
    The Price value in the Data Box refers to the price where your cursor is​.​

    Comment


      #3
      Hello Gaby,

      Using your code, when I write marketDataUpdate. there is list of values including Bid, Ask, Price, and Last. What is this Last?

      Comment


        #4
        Hello cliffhu,

        The Last price is the last traded price for the instrument which could be different from the ask/bid price depending on the market.​

        Comment


          #5
          Hello Gaby,

          How is it different than 'Price'? Which one should be used for latest price? Or which one will be Close price when bar is closed?

          Comment


            #6
            Hello,

            Price would be the current bid/ask/last price within OnMarketData. If you are getting the updates from OnMarketData(), marketDataUpdate.Price will get you the latest price.

            which one will be Close price when bar is closed?
            Could you provide further detail on what you mean by this? To get the closing price of a bar you can use the Close collection from within OnBarUpdate.

            Comment


              #7
              Suppose a bar close at 10:00 and the last market data update is at 09:59 and marketDataUpdate.Price = 100, so the Close of this bar from OBU will be 100? or will it be marketDataUpdate.Last?

              Comment


                #8
                Hello cliffhu,

                From my testing, when printing marketDataUpdate.Last from OnMarketData and Close[0] from OnBarUpdate() these values seem to match.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                49 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                126 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                67 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                42 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X