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

"Uncompilable NinjaScript"

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

    "Uncompilable NinjaScript"

    I just.... sometimes i think this is a beta.... so many errors...

    What do i have to do now to fix this? I even restart the computer...
    I created NEW STRATEGIES with NEW NAMES, NEW VARIABLE NAMES...
    etc etc...

    So i have to resintall again?

    I'm the only one having basic errors..?
    Attached Files

    #2
    BTW, how i manually "compile" a strategy which i only have access opening as a text file?

    Comment


      #3
      Hello Fernand0,

      Thanks for opening the thread.

      NinjaTrader gives you low level access for custom programming through the custom NinjaScript assembly. Since this part of the platform gets modified through adding and removing NinjaScripts, it is possible that an unwanted change can leave the assembly in an uncompilable state.

      More information on the impact of creating/using third party scripts can be referenced here - https://ninjatrader.com/support/help...tallingAdd-Ons

      These issues must be resolved by opening a NinjaScript Editor and compiling the custom assembly to see what errors are preventing the assembly from compiling. Pressing F5 in the NinjaScript Editor will recompile the custom assembly. From there you can either correct the programming errors, or you can remove NinjaScripts that have errors or exclude them from compilation. NinjaScripts can be excluded from compilation by right clicking on that NinjaScript in the NinjaScript Explorer tree on the right hand side of the NinjaScript Editor and selecting "Remove from Compilation."

      Steps that you can follow for correcting these errors can be referenced here - https://ninjatrader.com/support/help...jascript_p.htm

      A video on using the NinjaScript Editor can be seen here - https://www.youtube.com/watch?v=BA0W4ECyVdc

      The information above is publicly available.

      If you would like assistance in restoring your NinjaScript assembly to a compilable state, any of our support technicians will be able to assist you further on a remote support call. Please reach out to us at platformsupport[at]ninjatrader[dot]com if you would like to schedule a call. (Please include a time zone.) Our regular support hours are 8:30am to 6pm US Eastern, Monday through Friday.

      Please let us know if we may be of further assistance.
      Last edited by NinjaTrader_Jim; 05-22-2018, 07:50 AM.
      JimNinjaTrader Customer Service

      Comment


        #4
        Thanks for your fast reply Jim.

        i was able to delete the files.. restart.. and now i can use the Builder again...

        I edited the strategy myself, would you mind checking whats wrong?
        When i add it to a chart, as soon as i check "enable" and "apply"... it unchecks it self, no error appears.... and in the top-left appears the text "{D} Atlantis(34,5,5,8,4)" (it does not work)
        Attached Files

        Comment


          #5
          Hello Fernand0,

          When I enable this strategy, I don't hit any errors and the strategy enables as expected.

          When developing strategies and indicators it will always be necessary to check our work and make sure everything is written correctly. This can be done by creating another strategy with reduced logic to focus on a certain condition, and you can also add debugging prints within the Strategy Builder to check the logic as it executes. I have a demonstration video that explains how this can be done and I'll share a link for your development purposes later down the line.

          Debugging in the Strategy Builder - https://www.screencast.com/t/8uvjfM8h

          Please let me know if I may be of further assistance.
          Attached Files
          JimNinjaTrader Customer Service

          Comment


            #6
            It's because of the AddDataSeries(Data.BarsPeriodType.Range, 1);

            Strategy 'Atlantis': Error on calling 'OnBarUpdate' method on bar 2: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
            The funny thing is that with 2 Renko worked, now, it does not.

            Comment


              #7
              Hello Fernand0,

              Depending on the series you apply the strategy to, you may or may not have enough bars for your primary and secondary series when the strategy starts calculating. If there aren't enough bars and you try to reference some data that requires bars that are not available, you will hit the error you are seeing.

              If you add prints to each line of code in your strategy, you can reference the output window to see how far the strategy has gotten before hitting this error. I'll include additional debugging tips that build off of my previous reply.

              Debugging - https://ninjatrader.com/support/help...script_cod.htm

              Please also see the document below for more information on making sure you have enough bars in the data series you are referencing.

              Making sure there are enough bars in the data series you are accessing - https://ninjatrader.com/support/help...nough_bars.htm

              As a hint for the error you are receiving, your strategy starts after there is one bar available for both series.

              Code:
              if (CurrentBars[0] < 1
              || CurrentBars[1] < 1)
              return;
              You should look for BarsAgo references that look further back than one bar.

              Please let us know if you have any additional questions.
              JimNinjaTrader Customer Service

              Comment


                #8
                You, you are the man. lol

                I changed..

                Code:
                if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
                			return;
                for

                Code:
                if (CurrentBars[0] < 5 || CurrentBars[1] < 5)
                			return;
                and now it works, i will read more about this, but it was strange, of course, sometimes worked with 1 min, couple of attempts later, wasn't working anymore, and so on with differents BarsPeriodType

                Thanks for your time and your patience Jim.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DJ888, 04-16-2024, 06:09 PM
                4 responses
                12 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by terofs, Today, 04:18 PM
                0 responses
                8 views
                0 likes
                Last Post terofs
                by terofs
                 
                Started by nandhumca, Today, 03:41 PM
                0 responses
                6 views
                0 likes
                Last Post nandhumca  
                Started by The_Sec, Today, 03:37 PM
                0 responses
                3 views
                0 likes
                Last Post The_Sec
                by The_Sec
                 
                Started by GwFutures1988, Today, 02:48 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Working...
                X