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 cre8able, Yesterday, 01:16 PM
        3 responses
        11 views
        0 likes
        Last Post cre8able  
        Started by ChartTourist, Today, 08:22 AM
        0 responses
        4 views
        0 likes
        Last Post ChartTourist  
        Started by LiamTwine, Today, 08:10 AM
        0 responses
        2 views
        0 likes
        Last Post LiamTwine  
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Working...
        X