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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            133 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X