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 GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,281 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        19 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by Tim-c, Today, 02:10 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Taddypole, Today, 02:47 PM
        0 responses
        5 views
        0 likes
        Last Post Taddypole  
        Started by chbruno, 04-24-2024, 04:10 PM
        4 responses
        53 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Working...
        X