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

Question about OnBarUpdate and timing

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

    Question about OnBarUpdate and timing

    Hi,

    Could someone please clarify what happens in the following situation?

    The current Bid has only 20 lots at say 866.00 which are taken in a single order.

    The next OnBarUpdate processes this.

    As that happens will GetCurrentBid() return the just taken Bid of 866.00 or the new Bid of 865.75?

    I realise that I could get the Bid data via OnMarketData however as OMD and OBU dont always match (there is an intermitent 1 tick lag) it is possible when doing Bid/Ask analysis to apply OMD data incorrectly within the OBU portion of the indicator.

    Thanks

    #2
    GetCurrentBid() gets the bid at that point in time. If a new bid formed you will get the new bid.

    You can just run your bid/ask analysis from OnMarketData() or OnMarketDepth().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Thanks for the rapid reply...

      That is as I expected and yes i can use OMD however as mentioned in my first post this can return inconsistent results because of the lag issue.

      I appears (unfortunately) there is no way around the issue of getting 100% accurate Bid/Ask analysis with Ninja at the moment....

      Anything being done about this in version 7?

      Thanks

      Comment


        #4
        rt-trader,

        GetCurrentBid() just accesses the data directly. So it can actually be ahead of OnMarketData(). OnMarketData() is event driven so it is not necessarily the absolute latest bid price while GetCurrentBid() is the moment you call it. But remember, GetCurrentBid() from OnBarUpdate() is not updated on every single bid change since a bid change does not constitute a bar update event.

        As bid prices change back and forth it may seem like a delay but there really isn't one. Hope that helps.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the clarifications Josh...

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Started by alifarahani, Today, 09:40 AM
          6 responses
          41 views
          0 likes
          Last Post alifarahani  
          Working...
          X