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

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 Fitspressorest, Today, 01:38 PM
            0 responses
            2 views
            0 likes
            Last Post Fitspressorest  
            Started by Jonker, Today, 01:19 PM
            0 responses
            2 views
            0 likes
            Last Post Jonker
            by Jonker
             
            Started by futtrader, Today, 01:16 PM
            0 responses
            6 views
            0 likes
            Last Post futtrader  
            Started by Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,791 views
            0 likes
            Last Post aligator  
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            844 views
            0 likes
            Last Post emuns
            by emuns
             
            Working...
            X