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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            161 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            310 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            245 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X