Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          548 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X