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

Most efficient way to get live current bid/ask

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

    Most efficient way to get live current bid/ask

    Hello,

    I was wondering if you could just confirm something for me. If I want to get the current bid/ask, there seems to be 2 ways it is done. Via onmarketdata, or GetCurrentBid. My question is, is there any overhead with GetCurrentBid? Only, I see indicators like the price line using onMarketdata, and that would seem to use many more resources than say, a simple function call to getCurrentBid/Ask, if all that function is doing is returning a value it already has to hand?

    I did look in the docs, but it really does not go into any detail I could find about how GetCurrentBid actually works, internally. Would I be right in assuming GetCurrenBid, as needed, for example, 'onpricechange', would be more efficient than OnMarketData, where I would assume the entire tick stream is being sent to that function?

    Thanks.

    #2
    Hello pjsmith,

    Thanks for your post.

    GetCurrentBid/GetCurrentAsk will fetch the most recent Bid/Ask straight from the level 1 data feed before the bid/ask gets processed in NinjaTrader's data streams. This would be lighter if you occasionally need to reference a current bid/ask.

    Adding OnMarketData would be useful if you needed a stream of bid/ask/last to analyze the data and plot information like we do in an indicator. You are correct that the entire tick stream would be sent here.

    Let us know if there is anything else we can do to help.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fwendolynlpxz, Today, 05:19 AM
    0 responses
    3 views
    0 likes
    Last Post fwendolynlpxz  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by PaulMohn, Today, 03:49 AM
    0 responses
    8 views
    0 likes
    Last Post PaulMohn  
    Started by inanazsocial, Today, 01:15 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by rocketman7, Today, 02:12 AM
    0 responses
    11 views
    0 likes
    Last Post rocketman7  
    Working...
    X