Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MarketDataEventArgs Last vs. Price

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

    MarketDataEventArgs Last vs. Price

    What is the difference between Last and Price in this example?

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
            {
                if (e.MarketDataType == MarketDataType.Last){
                    Print(e.Price + " : " + e.Last);  
                }
    
            }
    The documentation on MarketDataEventArgs does not seem to have an entry for Last but it shows up in intellisense. I just want to confirm that Price is the tick of the actual update. Is Last the previous update?

    #2
    Hello swooke,

    Thanks for your post.

    MarketDataType.Last means the market data update is the last price at which the trade occurred, not necessarily a bid or ask. Price is the price of that bid/ask/last update. "Last" is not documented for regular use and would not be supported, but it does appear to show the price of the previous update.

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      In the above example, what is the proper way to parse the updates from multiple Instruments from inside the OnMarketData() section? I am guessing I cannot check BarsInProgress like I do from OnBarUpdate() from inside OnMarketData().
      Last edited by swcooke; 03-05-2019, 10:17 AM.

      Comment


        #4
        Hello swooke,

        BarsInProgress can be used in OnMarketData in the same fashion as in OnBarUpdate. You may test the following to observe in a Multi Time Frame/Instrument NinjaScript:

        Code:
        protected override void OnMarketData(MarketDataEventArgs e)
        {
            Print(String.Format("BIP: {0} Instrument.FullName: {1}", BarsInProgress, Instrument.FullName));
        }
        BIP: 1 Instrument.FullName: ES 03-19
        BIP: 0 Instrument.FullName: CL 04-19
        Please let us know if you have any questions.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by habeebft, Today, 07:27 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Max238, Today, 01:28 AM
        4 responses
        37 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by r68cervera, Today, 05:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X