Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get data from Ticker X while creating code for Ticker Y

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

    Get data from Ticker X while creating code for Ticker Y

    I want to get data from a different ticker from the one I am creating the strategy in.
    I know that GetCurrentAsk(); can be used to get the current ask price of the ticker the strategy is currently executing on, but how can I get the current ask price from a different ticker symbol?

    Thank you.

    #2
    Originally posted by joespo View Post
    I want to get data from a different ticker from the one I am creating the strategy in.
    I know that GetCurrentAsk(); can be used to get the current ask price of the ticker the strategy is currently executing on, but how can I get the current ask price from a different ticker symbol?

    Thank you.
    You will have to write a multi-time frame/instrument strategy.

    ref: http://www.ninjatrader.com/support/h...nstruments.htm

    Comment


      #3
      Exactly what I was looking for, thank you.

      One more question--

      How can I get the bid/ask for 20 minutes ago, how can I get it for a set time (say 10AM), and how can I get it for 20 bars ago? Will this same logic follow for indicators? (If I want MACD at 20 mins ago, at a certain time, and at 20 bars ago)

      Regards,
      Joe

      Comment


        #4
        joespo,

        I am happy to assist you.

        For this you would need to add a bid/ask data series and not all data providers offer bid/ask data. Here is some more information on the add() method.



        E.g. Add("ES 03-12", PeriodType.Minute, 1, MarketDataType.Ask);

        Would add a ES 03-12 , 1 minute data series using Ask data. If you needed to access 20 minutes ago you could use Closes[1][20] or something.

        Please let me know if I may assist fruther.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by joespo View Post
          Exactly what I was looking for, thank you.

          One more question--

          How can I get the bid/ask for 20 minutes ago, how can I get it for a set time (say 10AM), and how can I get it for 20 bars ago? Will this same logic follow for indicators? (If I want MACD at 20 mins ago, at a certain time, and at 20 bars ago)

          Regards,
          Joe
          To get the bar number for a specific time, you use the GetBar() function. Once you have the bar number you reference it by its index.

          Comment


            #6
            Thank you both for your help!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X