Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData VS OnBarUpdate

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

    OnMarketData VS OnBarUpdate

    Is there any difference between using OnBarUpdate

    Code:
    CalculateOnBarClose = False
    ..
    last=Close[0];
    bid = GetCurrentBid();
    ask=GetCurrentAsk();
    ... and OnMarketData
    Code:
    if ( marketDataType.Last) last = e.Price
    if ( marketDataType.Bid) bid = e.Price
    if ( marketDataType.Ask) ask = e.Price
    (Don't try to compile this at home)
    Last edited by Ramon; 02-17-2012, 12:23 PM.

    #2
    Hello Ramon,
    Thanks for writing in and I am happy to assist you.

    NinjaTrader being multi-threaded with OnMarketData and OnBarUpdate being called in their own respective thread, there can be difference between GetCurrentAsk() and e.Price as ask price derived from OnMarketData.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I supposed, however the latest crossed price should match in both methods . is it so? . I mean
      (last) e.Price == Close[0]

      or not?

      Comment


        #4
        Hello Ramon,
        It may or may not match since Close and e.Price are updated on different thread.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          In times of Livermore, Mr. Investor bought a contract to 890.25 and the tape recorded this fact

          Today Mr Investor Jr. buys a contract to 1342.75 and thanks to technology this fact depends on whether you use OBU or OMD.
          I do not think that the fact that Livermore shot himself in the head has nothing to do with the progress of computers.

          So , we better continue using OMD to record events in Level 1 (Time & Sales) ?

          Comment


            #6
            Hello Ramon,
            OnMarketData and OnBarUpdate has its own pros and cons. We provide you options, and it depends on your exact requirement, on how you utilize it to its optimum.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X