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 sgordet, Today, 11:48 AM
            0 responses
            1 view
            0 likes
            Last Post sgordet
            by sgordet
             
            Started by Trader146, Today, 11:41 AM
            0 responses
            2 views
            0 likes
            Last Post Trader146  
            Started by jpapa, 04-23-2024, 07:22 AM
            2 responses
            16 views
            0 likes
            Last Post rene69851  
            Started by funk10101, Today, 11:35 AM
            0 responses
            1 view
            0 likes
            Last Post funk10101  
            Started by samish18, Today, 11:26 AM
            0 responses
            1 view
            0 likes
            Last Post samish18  
            Working...
            X