Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsRequest & OnMarketData & OnMarketDepth

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

    BarsRequest & OnMarketData & OnMarketDepth

    Hello,

    Is there any way to subscribe to OnmarketData and OnmarketDepth events from a BarsRequest. I only find an Update method.

    Thanks in advance.

    #2
    Hello cls71, and thank you for your question.

    I am including a page from the help guide covering BarsRequest creation.



    As we can see from the code here,

    Code:
    [FONT=Courier New]barsRequest.Update[SIZE=3][B]+=[/B][/SIZE]OnBarUpdate;
    [/FONT]


    (emphasis mine) we use the += operator to imply we may subscribe to as many event handlers as we would like. We can subscribe to any methods that are either locally available or available globally in a static context. The example code uses its own OnBarUpdate method.

    The attached C# code includes a minimal code set which subscribes to methods with the 3 names you mentioned. Please let us know if there are any other ways we can help.
    Attached Files
    Last edited by NinjaTrader_JessicaP; 10-21-2016, 12:15 PM.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your attention Jessica, but I think your code is wrong. You are subscribing to the same event (BarUpdate) three times.
      I need subscribe to OnMarketData and OnMarketDept events like in Indicators and Strategies.

      Comment


        #4
        Thanks for mentioning this, you are correct. The example code in these help guide sections demonstrates how to subscribe to the same kind of MarketData and MarketDepth feeds that Indicators and Strategies do.

        MarketData


        MarketDepth


        My script had one other inaccuracy; as the example code in the above pages shows, we need to unsbuscribe from every feed we subscribe to.

        I have modified the code in my earlier post to reflect this. Please let us know if there are any other ways we can help.
        Last edited by NinjaTrader_JessicaP; 10-21-2016, 12:15 PM.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        41 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        11 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        7 views
        0 likes
        Last Post port119
        by port119
         
        Started by Philippe56140, Today, 02:35 PM
        0 responses
        7 views
        0 likes
        Last Post Philippe56140  
        Started by 00nevest, Today, 02:27 PM
        0 responses
        7 views
        0 likes
        Last Post 00nevest  
        Working...
        X