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

Stratey gone !

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

    Stratey gone !

    Built a strategy, ran ok. stoped working on it for a couple weeks. Started working on another strategy being developed by a friend who sent me his file which I restored in my NT. Then when trying to run the strategy I had been working on a few days before (also by restoring a backup file) it would no longuer work. "work" means it wont load up the signals in the chart and it wont fully run on the historical either. please help.

    #2
    Are you getting any errors in the Log tab?

    Comment


      #3
      ""Failed to call method "initialize" for strategy xxx: CurrentBarArray""

      Comment


        #4
        urbmiranda, thanks for the post - could you please post the Initialize() used in this strategy?
        BertrandNinjaTrader Customer Service

        Comment


          #5

          ***BEFORE THIS IS THE "VARIABLES" SECTION***

          ///<summary>
          /// This method is used to configure the strategy and is called once before any strategy method is called.
          ///</summary>
          protectedoverridevoid Initialize()
          {
          Add(PeriodType.Week,
          1);

          CalculateOnBarClose =
          true;
          }
          ///<summary>
          /// Called on each bar update event (incoming tick)
          ///</summary>
          protectedoverridevoid OnBarUpdate()
          {

          if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
          return;


          ***AFTER THIS COME THE CONDITIONS/RULES FOR THE STRATEGY***

          Comment


            #6
            That strategies Initialize() section looks ok, however this method is called across all scripts - so it could be an issue in another script that is preventing from you starting up this script. If you check the names of the files, is the error message really found in the file you opend up the code for in the editor?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              ok, I loaded up strategy A and it didnt work (my strategy), then tried strategy B (my friend's) and didnt work either. However, most of the errors in the log are talking about a strategy C which I have not tried to run recently.

              Also, I am getting another error in the Log diferent from the initialize one. The additional error reads "Unable to start market data for instrument ^S&P500. Provider does not support market data". seems odd since this is the plain vanilla good ole S&P so not sure what this is about or if this error in combination with the initialize one is what's causing the problem. I am using kinetic data, so again this seems odd.

              Comment


                #8
                It would not matter which script you run, as the Initialize() method is called across all strategy, so A B and C in your example here. Please comment out the the offending lines for a test (SP500 data access and the CurrentBars one) to check if you could then enable a strategy normally on your end.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I am not sure I follow what ou want me to do, could you please elaborate?

                  Comment


                    #10
                    What you would need to do is commenting out the Initialize() lines that cause this start up errors, for example the one where you attempt to access CurrentBarsArray and adding the ^SP500 data series. Then please rerun your strategy and check if it still would not run and generate any log tab errors.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by urbmiranda View Post
                      ***BEFORE THIS IS THE "VARIABLES" SECTION***

                      ///<summary>
                      /// This method is used to configure the strategy and is called once before any strategy method is called.
                      ///</summary>
                      protectedoverridevoid Initialize()
                      {
                      Add(PeriodType.Week,
                      1);

                      CalculateOnBarClose =
                      true;
                      }
                      ///<summary>
                      /// Called on each bar update event (incoming tick)
                      ///</summary>
                      protectedoverridevoid OnBarUpdate()
                      {

                      if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
                      return;


                      ***AFTER THIS COME THE CONDITIONS/RULES FOR THE STRATEGY***

                      I think you will need to declare some values of the variable BarsRequired values. For example, BarRequired = 20; so that the CurrentBars[0] or CurrentBars[1] will be compare to a value of nothing or 0. Have you check what value have you declared on BarRequired?
                      Last edited by luxurious_04; 09-24-2012, 05:51 AM.

                      Comment


                        #12
                        Thanks guys I will try your suggestions and come back. Much Appreciated.

                        Comment


                          #13
                          Ninjatrader support please take a look at this thread related to my problem but accidentally pasted on a new chat, any help is much appreciated as I am still stuck with this issue and I am no longuer able to run any self designed strategy on NT http://www.ninjatrader.com/support/f...ad.php?t=52773

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by sofortune, 05-18-2024, 11:48 AM
                          2 responses
                          31 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by Zach55, 02-19-2024, 07:22 PM
                          2 responses
                          65 views
                          0 likes
                          Last Post lbadisa1  
                          Started by JGriff5646, Yesterday, 05:47 PM
                          1 response
                          14 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by AlphaOptions, 06-18-2013, 08:24 AM
                          9 responses
                          2,203 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Started by ttrader23, Yesterday, 09:33 AM
                          3 responses
                          27 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Working...
                          X