Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add(PeriodType.Day, 1) Prevents OnBarUpdate on historical bars?

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

    Add(PeriodType.Day, 1) Prevents OnBarUpdate on historical bars?

    Hi,

    I used the TradeStation stragegy to extract the attached data, and imported it into NT (ER2 since 1/2/2007 - oops, the forum doesn't allow attachments this big, file not attached). When I open an output window, create a chart with hourly bars and apply the attached strategy there is only one line printed to the output window from OnBarUpdate, for the last bar on the chart. It appears OnBarUpdate does not execute for the historical bars on the chart. There are no historic trades shown on the chart.

    If I then comment out the Add() in Initialize, compile and reload NinjaScript, the output window shows lines for historical bars since 20070617. (I have 'days back' on the chart set to 17, changing 'days back' to 100 gets output lines starting with 20070326.) Historical trades are also displayed on the chart.

    A couple of questions:
    - How can I create a multi-time frame chart with hourly and daily bars, and get OnBarUpdate to execute for historical bars and historical trades displayed on the chart?
    - Would it be possible to expand the size limit for zip file attachments? The current limit of 98k prevented attaching the data file.

    Thanks,
    Darryl
    Attached Files

    #2
    - please check out logs if there are some funny messages indicating the cause of the trouble
    - make sure you have set "Exit On Session Close" option to False
    - we will not expand the attachment limit to protect the forum against spam robots. You always can submit large attachments by Help->Mail to support
    - If problem persists: please PM me both data files for daily and intraday data to "dierk AT ninjatrader DOT com" using the Help->Mail to support function.

    Comment


      #3
      There are no funny messages in the logs.

      The setting of exit on close is the same with or without the Add() commented out, so would appear to be irrelevant.

      The problem 'persists', files have been emailed.

      Thanks,
      Darryl

      Comment


        #4
        Thanks. I PM'ed you.

        Comment


          #5
          Daily data problems...

          Hi,

          I imported daily data for the same symbol and time window (since 1/2/2007) and plotted a chart, screenshot attached. A couple of highlights:
          - The date scale appears to be European (day, month, year) but my system is set for Eastern US (should be month, day, year?).
          - Not all the data is plotted. The imported data ends in March, then current simulator data plots a bar. Either the import didn't bring in all the data in the file, or the chart isn't showing it all. How can I tell which, and correct it?

          Thanks,
          Darryl
          Attached Files

          Comment


            #6
            - apparently your local PC settings go with European date formatting. You need to change it to US if you want to have US date formatting
            - Did you rename the to ER2 09-07 to make sure you are importing to that expiry?

            Comment


              #7
              I already said my time zone is Eastern US. Please see attached screenshot of regional settings to confirm my machine is not set to European date format. Given my machine settings are US, why is NT showing daily chart dates in European format?

              Since it wasn't necessary to rename the import data file when importing the one minute bars I didn't think it was necessary to rename the file to import the daily bars. Just for giggles, I renamed the import file to ER2 09-07.txt and imported again, it didn't make any difference. The chart still does not show all the data. What happens when you import the data and create a chart with it?

              What else do you need from me to diagnose and correct these problems?

              Thanks,
              Darryl
              Attached Files

              Comment


                #8
                a) My apologized. The formatting bug must have been introduced lately. We'll fix it with next release.
                b) I tried importing the file you attached this morning (before and after renaming to ER2 09-07) into an empty DB and it worked well: daily data shows up to 2007-06-29 as expected

                Comment


                  #9
                  I'm glad to hear you were able to import and chart the complete data file. What is it I need to do so I can get the same result?

                  Comment


                    #10
                    Originally posted by DarrylT View Post
                    I already said my time zone is Eastern US. Please see attached screenshot of regional settings to confirm my machine is not set to European date format. Given my machine settings are US, why is NT showing daily chart dates in European format?
                    Hi Darryl,

                    Please:
                    - open a chart
                    - open chart properties
                    - set 'Date label format for daily bars' to MM/dd/yyyy
                    - close chart properties
                    - context menu -> Templates -> 'Save As Default'
                    - close chart
                    - open new daily chart ==> chart has US daily settings

                    Date format is european, because it was initialized wrong. I changed the initialization, will be available in the next release.
                    ChristianSenior Software Developer

                    Comment


                      #11
                      Originally posted by DarrylT View Post
                      I'm glad to hear you were able to import and chart the complete data file. What is it I need to do so I can get the same result?
                      I suggest trying with an empty DB and see if you could reproduce by results.

                      Comment


                        #12
                        Christian - thanks, that works great.

                        Dierk - I tried to use Instrument Manager to delete a symbol, but it doesn't look like that option exists. I can delete an instrument list, and delete a master instrument. But it appears one can only remove a symbol from an instrument list, not sure if that deletes it from the db. When I did the remove and tried to close Instrument Manager it wouldn't, and instead repeatedly gives the Unhandled Exception in the attached screenshot. I tried continue several times, but finally had to quit and send crash information to Microsoft to get out of NT. After re-opening NT the symbol was still present, removing it worked this time (maybe having an open chart during the previous remove attempt caused the Exception). After re-importing the daily data it is all now visible on the chart.

                        Thanks,
                        Darryl
                        Attached Files

                        Comment


                          #13
                          Great you got it resolved. I tried to reproduce what you experienced on the instrument manager, but did not encounter any problem: Instrument in the list was deleted as expected as I removed the "master" on the grid.

                          I suggest you do a DB repair: Tools->Options->Misc->Repair DB

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          567 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          330 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          548 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          548 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X