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

Data question

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

    Data question

    hello

    i'm importing UTC ninjatrader (beggining of bar timestamps)

    I've imported the data. after importing the data, I exported the data out of NT and compared it to the data that I imported.

    this is end of day data

    the data when I'm comparing the EOD values, is exactly the same

    for example

    10/9/2018 = 10 //for the export from NT
    10/9/2018 = 10 // the data I have externally

    i'm added this data series to a strategy. I restarted the strategy and refreshed the data.

    now I am printing the current Closes[1][0] to the output window.

    today is 10/10/2018 and after 5pm.

    for some reason when I'm printing the data, it's printing data for 10/9/2018 rather than 10/10/2018. doesn't a new day started at 5PM?

    #2
    Hello staycool3_a,

    Thanks for your post.

    Time[0] will represent the time stamp of the bar that has just closed or the developing bar if using Calculate.OnPriceChange or Calculate.OnEachTick.

    If you have realtime data for that data series, then you should be able to see the timestamp for the next bar that is developing. Otherwise I would not expect to see a new bar forming, and I would not expect Closes[1][0] to have a new timestamp.

    If this information does not help resolve your inquiry, could you attach an small set of data you were using to test as well as some detail on how you are printing these timestamps?

    I look forward to being of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello staycool3_a,

      Thanks for your post.

      Time[0] will represent the time stamp of the bar that has just closed or the developing bar if using Calculate.OnPriceChange or Calculate.OnEachTick.

      If you have realtime data for that data series, then you should be able to see the timestamp for the next bar that is developing. Otherwise I would not expect to see a new bar forming, and I would not expect Closes[1][0] to have a new timestamp.

      If this information does not help resolve your inquiry, could you attach an small set of data you were using to test as well as some detail on how you are printing these timestamps?

      I look forward to being of further assistance.
      Time[0] - correct. My strategy is Calculate.OnBarClose and the primary data series a 120 minute bar.

      the data series that I am adding does not have realtime data, hence, I have to manually update this data series from an external data source. The data series I am adding is a daily data series and my primary data series is 120 minute.

      therefore,

      primary data series = 120 minute
      secondary data series = daily OHLC

      The strategy is added on a chart for 120 minute and the output is printed via:

      Print(string.Format("{0};{1}",Time[0],Closes[1][0]));

      assume:
      closing value for secondary dataseries 10/09/18 at 5pm is 20;
      closing value for secondary dataseries 10/10/18 at 5pm is 10;

      the output I would expected before 5pm on 10/10/18:
      1pm; 20
      2pm; 20
      3pm ;20
      4pm; 20
      5;pm; 10

      after 5 pm I would expected this output:

      6pm; 10
      7pm; 10


      right?

      Comment


        #4
        actually i think this may not be an issue. the reason why I am still seeing 10/9/2018 is b/c I am using a 120 minute and the new bar will form at 7pm so then I should be getting 10/10/2018 values.

        stay tuned for confirmation.

        Comment


          #5
          yea that didn't work. something is off. it kept the value for 10/9/2018 even though clearly today is not 10/9/2018..

          i ran the strategy in strategy analyzer and the outputs are correct. every day at 5pm, the new value is entered.

          when the strategy is live.. OR if i run the strategy analyzer all the way to the current day.. the new value does not update after 5pm...
          any suggestions?

          the strategy analyzer output clearly shows the data is there and the data has the correct values and dates but when is this not happening in realtime or if the analyzer is ran until current day... it's lagging by a day

          update:

          i forgot to mention, this second data series that I am entering is a CUSTOM instrument.

          when i open this custom instrument on a chart.. the 10/10/2018 closing value is actually correct.. it's just not correct when it's pulled into the strategy. my data templates for the strategy are all the same (forex) and they match this instrument's template

          i added a third data series for the primary data series for a non-custom instrument and the values. this is daily OHLC data series. this one actually updated at 5pm. so apparently my issue is only isolated to a custom instrument..
          Attached Files
          Last edited by staycool3_a; 10-10-2018, 06:11 PM.

          Comment


            #6
            The issue has to do something with the trading hour template. and i'm at a loss on how to fix it...

            trading hour template i am using is forex

            this is a custom instrument

            forex template (default that comes with NT) start time and end time are 5pm

            the data i am loading is with 5pm time stamps.. when i view the data in the internal NT database.. it shows the 10/10/18 5pm price at X
            when i load it on chart.. it refuses to load 10/10/18 data.. it stays on 10/9/18 data.. when i play around with the template and change it to equities RTH.. (end time 4pm) then 10/10 loads..
            weird thing is.. if i load a regular forex instrument.. with a forex template.. it loads until 10/10/18. so this template stuff isn't working correctly for custom instruments

            Comment


              #7
              Hello staycool_3a,

              I may have gotten slightly distracted/confused about the issue at hand. Trading Hours templates will filter data that is available for building a bar. To focus more on the output you are expecting and what NinjaTrader is presenting, let's step back from trading hours templates for a moment and look at your example in post #3.

              Print(string.Format("{0};{1}",Time[0],Closes[1][0]));

              assume:
              closing value for secondary dataseries 10/09/18 at 5pm is 20;
              closing value for secondary dataseries 10/10/18 at 5pm is 10;

              the output I would expected before 5pm on 10/10/18:
              1pm; 20
              2pm; 20
              3pm ;20
              4pm; 20
              5;pm; 10

              after 5 pm I would expected this output:

              6pm; 10
              7pm; 10
              If you are printing on BarsInProgress == 0, then Time[0] will represent the timestamp of the the primary data series. Closes[1][0] would represent the value of the last bar closure for the secondary data series. If you only have data until the 9th, then you will continue to see Time[0] iterate, but Closes[1][0] would not update as it represents the timestamp of the last bar that closed on that series.

              If you print Times[1][0] alongside Closes[1][0], then you will see the timestamp associated with the last bar that has closed on that data series. Since you do not have realtime data for this instrument, the last bar timestamps you see for Times[1][0] should not exceed 10/9/2018 since that is the last day of data you have for that bar.

              If this does not help clear up the matter let's look further into the output from below to focus on what is seen for the data series you imported.

              if (BarsInProgress == 0)
              Print(string.Format("{0};{1}",Times[1][0],Closes[1][0]));

              Testing this print, please let us know the output you are receiving, what you expect, and the last data you have for this instrument so we can give further input.

              I look forward to being of any further assistance.
              JimNinjaTrader Customer Service

              Comment


                #8
                Jim it seems to be working fine right now. I'll have to confirm what happens after 5pm. Deleting the Cache folder helpled...

                I have another data question

                If I have "get data from server" under option tab -> market data

                and

                I do NOT have the underlying data loaded on a chart but the data series IS loaded in a strategy using the supported methods (adddataseries)

                does the script ask for updated data series?

                my scenario is:

                i'm loading daily data series in a strategy and adding the strategy on strategy tab. i just want to make sure the newer data is loaded at 5pm for the daily data series within my strategy automatically on new day without having to manually download the data by opening a chart

                Comment


                  #9
                  Hello staycool3_a,

                  When AddDataSeries gets called, it will ask for as much historical data that is specified in the AddDataSeries() method (if you are using the barsToLoad overload) or enough data to align the data series with the primary data series. If you start the strategy at one time, and enable it later, you would be requesting more recent data than the first time you enabled.

                  "Get data from server" is just an option to download historical data from the provider's historical data servers. If it's disabled, you will only use data on your PC and will not request historical data from your provider.

                  After processing historical data, NinjaScripts then transition to realtime data and calculate off the data that is streamed in from your data provider.

                  If there is anything else we can do to help, please let us know.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    ignore this. i ended up just using streamreader to get this data. i'm all set. thanks for the help

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by funk10101, Today, 09:43 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post funk10101  
                    Started by pkefal, 04-11-2024, 07:39 AM
                    11 responses
                    37 views
                    0 likes
                    Last Post jeronymite  
                    Started by bill2023, Yesterday, 08:51 AM
                    8 responses
                    44 views
                    0 likes
                    Last Post bill2023  
                    Started by yertle, Today, 08:38 AM
                    6 responses
                    26 views
                    0 likes
                    Last Post ryjoga
                    by ryjoga
                     
                    Started by algospoke, Yesterday, 06:40 PM
                    2 responses
                    24 views
                    0 likes
                    Last Post algospoke  
                    Working...
                    X