Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

how to get historical data

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

    how to get historical data

    Hi,
    Let's say that there is a scenario:
    Market could open at 9AM everyday, and I turn on my computer and launch NinjaTrader at 2PM everyday.
    So I want to get those historical data from 9AM to 2PM on same day (sometime need more data yesteray)
    is it possible to get those data programmatically or just download directly?

    Thanks

    #2
    Hello UMLer,

    That should happen automatically when you connect and subscribe to that instrument by using a chart or any other tool which requests historical data. There is nothing in your cod that would need to be changed to use the historical data in the platform.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Questions 1:
      I remember there is a array, something like this:
      on a 15min candle chart:
      Bars[0] means last candle bar, time is 9:15 AM, Bars[1] is the second to last candle bar. time is 9:00AM, right?

      I guess i can read close price like below:
      float thePrice = Bars[0].ClosePrice;

      Question 2:
      I want to get historical data dependence on different time frame. such as 15min, 1hr, 10s. how to do it?
      have to open different time frame charts?

      Thanks

      Comment


        #4
        Hello UMLer,

        Questions 1:
        I remember there is a array, something like this:
        on a 15min candle chart:
        Bars[0] means last candle bar, time is 9:15 AM, Bars[1] is the second to last candle bar. time is 9:00AM, right?
        You can use BarsAgo like that, not specifically on the Bars object but on other series like Close: Close[0] or Close[1]

        I guess i can read close price like below:
        Code:
        double thePrice = Close[0];
        Question 2:
        I want to get historical data dependence on different time frame. such as 15min, 1hr, 10s. how to do it?
        have to open different time frame charts?

        Before moving into multi timeframes I would suggest reading the following document:

        https://ninjatrader.com/support/help...lightsub=multi

        You will need to use AddDataSeries for that task.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks
          If I use BarsAgo or Close array then I can visit every element by index. what i want to is to get data 10 days ago.
          Of course I still can visit every element by index and check date and time until reach those data i want. But is there
          a way to visit elements by date and time directly ?

          Comment


            #6
            Hello UMLer,

            If you know a specific time that exists in the series you can search for that time to get the bar index, https://ninjatrader.com/support/help...ightsub=getbar

            That returns an Index which is different than BarsAgo. you can use the index directly with the GetValueAt method otherwise you would have to use CurrentBar - foundIndex to get a number of BarsAgo from where you are at in processing.



            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,606 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            15 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X