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

alBuys vs OnMarketData

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

    alBuys vs OnMarketData

    I have an indicator I did a long time ago which used BuySellVolume at the time as a base and it used theOnMarketData method.

    I just looked at my current ninja base BuySellVolume indicator source code and see it uses a different method of GetCurrentAsk and GetCurrentBid then using "Volume".

    Is there some advantage or pros or cons using the GetCurrentAsk method over OnMarketData? What I have works fine but didn't know if this new method is better in some way. If ninja is using this method I am guessing it is better for some reason.

    Can you enlighten me?
    Last edited by ct; 11-04-2012, 02:11 AM.

    #2
    I changed my indicator to the new method using GetCurrentAsk and seems like it's faster plus it agrees exactly to the VOL indicator where as before I used to get small discrepancies on occasion.

    Comment


      #3
      Hello ct,
      Thanks for your note.

      OnBarUpdate and OnMarketData runs on separate thread and thus the data may differ. Please refer to our help guide to know more.

      4. With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa.


      If you are comparing/matching the bid/ask price with the last traded price in the OnBarUpdate event then please use GetCurrentBid/GetCurrentAsk functions.
      JoydeepNinjaTrader Customer Service

      Comment


        #4
        Joy


        Thanks for the reply.

        Appreciate the separate threads and event based scenario. It there any performance considerations?

        Comment


          #5
          Hello ct,
          Yes, OnMarketData is the raw data stream and can be CPU intensive depending on your code.

          This is a real-time data stream and can be CPU intensive if your program code is compute intensive (not optimal)
          http://www.ninjatrader.com/support/h...marketdata.htm
          JoydeepNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by f.saeidi, Today, 11:02 AM
          1 response
          2 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          4 responses
          12 views
          0 likes
          Last Post geotrades1  
          Started by rajendrasubedi2023, Today, 09:50 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by lorem, Today, 09:18 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          4 responses
          30 views
          0 likes
          Last Post geddyisodin  
          Working...
          X