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

Current Historical Close Value Changes

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

    Current Historical Close Value Changes

    Noticed today that when I test a strategy in NT8 64bit that if I run it using Day periods for a year that the current close "Close[0]" outputs a number such as 71.21 BUT if I change the span to over 3 years the output for close "Close[0]" outputs a number such as 71.2144. I can change the time span back to a year and it will again only output 71.21.

    It adds an additional two decimal places somehow.
    Example comes from: AAPL, Last, Day, 2013, 8/14/2013 Close=71.21

    I reviewed the Historical Data for that day, time, and symbol and it only lists 2 digits after the decimal. I can rerun the strategy several more times NOT changing anything and eventually the current close will output something like 71.2144012451172 giving 13 places past the decimal for the same date and time that it used to only give 97.21.

    What gives? Is this a memory issue in NT8 or in my PC or what?
    Anyone else seen this before?
    Last edited by antrux; 07-28-2016, 05:11 PM.

    #2
    Hello antrux,

    Thank you for writing in.

    I am not seeing this on my end when testing with an indicator script with the simple print statement below:
    Code:
    protected override void OnBarUpdate()
    {
         Print(Close[0]);
    }
    For further clarification, please provide the following information below:
    • Who are you connected to?
    • What version of NinjaTrader 8 are you running? This can be found under Help -> About
    • Are you able to see this behavior after deleting all of your historical data and testing again (Tools -> Historical Data)?
    • Can you provide the script that you are seeing this behavior occur on?
    • Are you testing this on a chart? Or the Strategies tab (if this is a strategy)?
    • Can you provide a screenshot of the Data Series window of your chart (if added to a chart)? If added to the Strategies tab, can you provide a screenshot of the strategy's Data Series parameters?


    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Currently connected to TDA.
      NT8 8.0.0.12 64-bit (Multi-Broker) - BETA
      Generating code:
      Code:
      // Create New Log Entry For This Bar //
      if (logging)
      {
          using (StreamWriter sw = File.AppendText(path + userName + desktop + Instrument.MasterInstrument.Name + " - Strategy52LowHigh.csv"))        //Creates new log file entry with the following values
          {
              sw.WriteLine(Time[0] + "," + buyStatus1 + ","  + buyStatus2 + "," + buyStatus3 + "," + buyStatus5 + "," + buyStatus6 + "," + buyStatus4 + "," + sellStatus1 + "," + sellStatus2 + "," + sellStatus3 + "," + sellStatus4 + "," + Close[0] + "," + Position.AveragePrice + "," + sharesToBuy + "," + Position.Quantity + "," + currentCash + "," + spendingCash );
          }
      }
      Created from Strategy Analyzer
      Screenshot attached.
      Removed all historical data from the manager and used Load to get 1/1/2009 - 7/28/2016 and retested with same results.

      I know that Close[0] is a double variable but it shouldn't be adding extra decimal places even due to rounding. All other strategies that I've tested/used are for minute bars and this was the first day bars that I've used and is why I enabled the logs to verify actions.
      Attached Files
      Last edited by antrux; 07-29-2016, 08:14 AM.

      Comment


        #4
        Hello antrux,

        As a test, please disconnect from TD Ameritrade before conducting your backtest when you are able to.

        Are you able to see this behavior still occur when disconnected on a backtest?

        Can you please provide the actual script itself so I may test it on my end? The script will be located within (My) Documents\NinjaTrader 8\bin\Custom\Strategies on your computer.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Yes, the same thing happens even while disconnected from TDA.

          The attached code should reproduce the results. It did on my end however it didn't require 3 years or more of day data to do so this time. Have found that running this on Day data gives too many decimal places but running it on Minute data returns only two places after the decimal.

          Last tested Timeframe: AAPL (Minute and Day)
          3/31/2016 to 7/29/2016

          Either modify the path for the log file or simply create a folder on the current user's desktop called "Trade Log" and it will write there.

          NOTE: Careful using Excel to view the files as sometimes excel will auto round the close price to 2 decimal places and sometimes it will not. A text editor such as TextPad or Notepad will always display the full values in the csv file..

          Also attached is a CSV output from this strategy that show this result. The first portion was created by using Minute data and the end is Day data.
          Attached Files

          Comment


            #6
            Hello antrux,

            Unfortunately, I am not able to reproduce this on my end.

            Please attach your daily data pertaining to AAPL for this year in your reply post so I may investigate further.

            This file can be found within Documents\NinjaTrader 8\db\day\AAPL

            It will be called 2016.Last.ncd
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Data is attached.

              So what else do you think might be different?
              This is running on a new Win10 Home machine with latest updates.
              Other than that and the source of the data nothing should be different right?
              Last edited by antrux; 07-30-2016, 02:48 PM.

              Comment


                #8
                Hello antrux,

                I do not see the 2016.Last.ncd file attached to your post.

                I would not be able to determine what would be causing this at this point as I am unable to reproduce this with my own data. I would like to test your data to see if I am able to see this behavior occur as well.

                Please ensure that you have attached the 2016.Last.ncd file to your follow-up post.
                Zachary G.NinjaTrader Customer Service

                Comment


                  #9
                  ah, rar files are not allowed. The zip is now attached.
                  Attached Files

                  Comment


                    #10
                    Hello antrux,

                    Thank you for providing your historical data. I would like to confirm that I can, indeed, see this behavior as well with the data you have provided.

                    I will be looking further into this, but as a test, rather than using TD Ameritrade, use the Kinetick End of Day feed. Open an AAPL daily chart while connected, right-click on the chart, and then select Reload All Historical Data. This will replace your previous TD Ameritrade daily data with the data from Kinetick.

                    After doing this, run your backtest once more.

                    Do you still see the behavior?
                    Zachary G.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello antrux,

                      I wanted to provide some additional details from my investigation.

                      It looks like I'm only seeing this happening on historical daily data with TD Ameritrade. I did want to note that I don't see this behavior in NinjaTrader 7, so I've reported this as a bug. Thank you for catching this!
                      Zachary G.NinjaTrader Customer Service

                      Comment


                        #12
                        Sorry for the long delay back.
                        Yes, after deleting historical data and using Kinetic data the issue went away and yes I had to revert to NT7 for testing as well. It is nice to see that it's not just me and possibly something crazy that I've done.

                        Note: As many if not most NT users seem to trade futures, which TDA would not be very good for doing so, there are still some other easily found issues with NT8 and TDA. I only trade equities but love NT for the C# development abilities and better UI than TradeStation so not many current users may have tested much with NT8 and TDA. From a fresh clean install connect to TDA and attempt to Load historical minute data for 1 year of the S&P 500 list. If any data is downloaded then it is only 2-3 symbols. You must select Day & Minute data to load and then it may take many repeated presses of the Download button in order to get any of it. I found however if you imported NT7 data first to NT8 then do a reload of the 500 listing then it is much more likely to actually sync and get data from TDA afterwards. It is almost as if the db entries are not created so data can't be downloaded yet but if after importing those db entries then exist and it will do much better then.

                        Either way my IB account is finally funded so no more TDA.
                        Thanks Zach,
                        Joe

                        Comment


                          #13
                          Hello antrux,

                          I have tested this on my end and am seeing the cause of this due to a request is not valid error showing in the trace. This error is due to requesting too much data from TD Ameritrade.

                          You will need to reduce the amount of days to obtain historical data for.

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

                          Comment


                            #14
                            Ah, well that would make sense. would be nice to increase the verbosity of the NTLog to see more of that easily and IF TDA would give more human readable error codes.
                            I've already found that same issue with IB and their pacing violations so just damn. Researching data feed providers now.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by tomd, Today, 02:38 PM
                            0 responses
                            1 view
                            0 likes
                            Last Post tomd
                            by tomd
                             
                            Started by Petrv333, Today, 02:03 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NInjaTrader_MaxH  
                            Started by stafe, Today, 12:34 PM
                            2 responses
                            23 views
                            0 likes
                            Last Post stafe
                            by stafe
                             
                            Started by asmmbillah, Today, 11:18 AM
                            1 response
                            19 views
                            0 likes
                            Last Post NinjaTrader_ChrisL  
                            Started by nickse2003, Today, 09:56 AM
                            1 response
                            30 views
                            0 likes
                            Last Post NinjaTrader_ChristopherJ  
                            Working...
                            X