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 sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,262 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by WeyldFalcon, 12-10-2020, 06:48 PM
          14 responses
          1,429 views
          0 likes
          Last Post Handclap0241  
          Started by DJ888, 04-16-2024, 06:09 PM
          2 responses
          9 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          41 views
          0 likes
          Last Post jeronymite  
          Working...
          X