• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData

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

    OnMarketData

    hi,
    is it possible to get data with OnMarketData of an different instrument on any chart-instrument?
    have it for my chart-instrument, but need a second say QQQ in the same chart.
    br
    Attached Files
    Last edited by mate41; 05-20-2016, 08:40 AM.

    #2
    Hello mate41,

    Thank you for writing in.

    OnMarketData() will be called for all unique instruments in your strategy. If you wish OnMarketData() to provide information about a different instrument, you will need to Add() that instrument in Initialize().

    More information about Add() can be found here: https://ninjatrader.com/support/help.../nt7/?add3.htm

    More information about OnMarketData() can be found here: https://ninjatrader.com/support/help...marketdata.htm

    Lastly, more information about multi-time frame and multi-instrument strategies can be found here: https://ninjatrader.com/support/help...nstruments.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thanks, i use already OnMarketData on the first instrument, no problem.
      But when i add a second instrument, how can i call the types of the second instrument ?

      Comment


        #4
        Hello mate41,

        With multi-time frame and instrument strategies, OnMarketData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument. (BarsInProgress will return the first BarsInProgress series that matches the instrument for the event)

        For example:
        Code:
        protected override void Initialize()
        {
             // AAPL will be at BIP 1
             Add("AAPL", PeriodType.Minute, 1);
        }
        
        protected override void OnMarketData(MarketDataEventArgs e)
        {
             // if AAPL has called OnMarketData(), do something
             if (BarsInProgress == 1)
                  // do stuff
        }
        For more information about BarsInProgress, please take a look at this help guide link: https://ninjatrader.com/support/help...inprogress.htm
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          If i understand i can only use 1 instrument, not 2 at the same time ??

          Comment


            #6
            Hello mate41,

            There is no limitation to how many instruments you can add to a script. However, please note that some data providers may place a limitation on how many instruments you are requesting real-time data from at once.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Thanks, so i've to detect if one or another is in progress. I wonder when they are both on +/- the same time.
              I'll try it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by SAILIKITY, 05-22-2019, 05:41 PM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by rmillar, 01-09-2019, 06:02 PM
              6 responses
              50 views
              1 like
              Last Post eDanny
              by eDanny
               
              Started by mlarocco, Today, 11:39 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by roblogic, Today, 11:19 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Started by saeed, Today, 10:17 AM
              8 responses
              31 views
              0 likes
              Last Post NinjaTrader_Kate  
              Working...
              X