Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add( PeriodType.Day, 1 ) - NT7 does not work

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

    Add( PeriodType.Day, 1 ) - NT7 does not work

    I am adding a secondary data series via Add( PeriodType.Day, 1 );

    As soon as I add this line, NT7 stops processing my OnBarUpdate() code. BarsInProgress is not the issue as I have a Print right before it that never executes. No errors are reported. I have tried try/catch, and nothing shows. There is nothing in log window.

    I have set max bars lookback to infinite in Strategy Analyzer.

    My data has daily values.. I can see them in Historical Data Manager.

    Please help, and let me know if there is additional debugging I can do.

    Thanks!

    #2
    Hello,
    Are you adding the secondary data series in Initialize() or OnBarUpdate()?
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Hi Cody,

      Thanks a lot for quick reply.

      I add it in Initialize()

      Comment


        #4
        Instead of daily, I did this:

        Add( PeriodType.Minute, 5 );


        My primary series is 1 minute.

        It worked!

        So I don't know what is wrong when I switch to daily data. Anyway to debug this?

        Comment


          #5
          Hello,
          For me to fully assist with debugging your strategy I will need to view it fully.
          You can attach your Strategy to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Strategy> select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

          If you would rather email it you can email it to platformsupport[AT]ninjatrader[DOT]com.
          Cody B.NinjaTrader Customer Service

          Comment


            #6
            Hi Cody,

            To simplify debugging, instead of sending you my long script, I took the following code from the site and ran it. It works fine. Then I changed the time to Day, 1. It no longer produces any results.

            I even changed this:
            if (SMA(20)[0] > SMA(BarsArray[1], 20)[0])
            to:
            if ( true )

            and no results show.

            Makes me there is a data issue? But there are no errors showing anywhere. And manual checking of the data for the time period shows it to be just fine.



            ------------------------
            protected override void Initialize()
            {
            // Add a 5 minute Bars object which is added to the BarArray
            // which will take index 1 since the primary Bars object of the strategy
            // will be index 0
            Add(PeriodType.Minute, 5);
            }

            protected override void OnBarUpdate()
            {
            // Ignore bar update events for the supplementary Bars object added above
            if (BarsInProgress == 1)
            return;

            // Pass in a Bars object as input for the simple moving average method
            // Checks if the 20 SMA of the primary Bars is greater than
            // the 20 SMA of the secondary Bars added above
            if (SMA(20)[0] > SMA(BarsArray[1], 20)[0])
            EnterLong();
            }

            Comment


              #7
              Hello,
              I have tested this and I am unable to reproduce what you are seeing.
              How many Days to Load do you have set in the Data Series? To view this from the chart you will right click> Data Series> Days To Load. To view this from the Strategies Tab right click on the Strategy > Edit Strategy> Days To Load.

              Do you have any errors appearing in the log tab of the control center?

              I look forward to your reply.
              Cody B.NinjaTrader Customer Service

              Comment


                #8
                Cody, problem solved

                Your point was the correct answer.

                Backtest from/to timeframe, I did not have enough days to load to accommodate the second data series (the daily). So it would silently ignore the backtesting. So once I added 20 more back days (to accomodate EMA(20), etc.) then everything worked.

                Thanks and sorry for the trouble.

                steve

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                4 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                40 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X