• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


after compile a new strategy, it doesn't appear as available!

  • Filter
  • Time
  • Show
Clear All
new posts

    after compile a new strategy, it doesn't appear as available!

    I am compiling successfully a new strategy, it appears in the folder Strategies of the NinjaScript Editor,
    but when I want to insert it on a chart, this new compiled strategy doesn't appear in the list of available strategies!!!!
    What's happening ?

    Hello Parmenides48,

    First, compile the script again then, may I have a screenshot of the Name field in OnStateChange() of the Strategy?

    Also, may I have a screenshot of the Strategies window scrolled to where this would appear alphabetically in the list?

    Do any compile errors appear when compiling?
    Chelsea B.NinjaTrader Customer Service


      I compiled again ,with no errors, and
      I send yoyu screenshots of the Name field, Strategies window and Strategies available when I try to insert on a chart
      Attached Files


        Hello Parmenides48,

        The namespace doesn't seem to match the folder it is in.

        May I have the script to test on my end?

        To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
        1. Click Tools -> Export -> NinjaScript...
        2. Click the 'add' link -> check the box(es) for the script(s) you want to include
        3. Click the 'Export' button
        4. Enter a unique name for the file in the value for 'File name:'
        5. Choose a save location -> click Save
        6. Click OK to clear the export location message
        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
        Below is a link to the help guide on Exporting NinjaScripts.

        Once exported, please attach the file as an attachment to your reply.
        Chelsea B.NinjaTrader Customer Service


          Hello again, I do it,
          Attached Files


            Hello Parmenides48 ,

            The script you have provided does not match the code in the screenshot.

            'namespace NinjaTrader.NinjaScript.Strategies'

            Have you modified the code?
            Chelsea B.NinjaTrader Customer Service


              I don´t have modified the code.
              I just created a new folder in Strategies folder, and I put inside the new folder my script, trying to find the solution,
              but after that I removed the script from the new folder and put it in Strategies folder again, and deleting the new folder.
              But in all cases the mtsb strategy doesn't appear in the window of strategies available


                Hello Parmenides48,

                I'm wanting to test exactly what you have provided a screenshot of so that if it works on my end there isn't any confusion about what is different.

                However, the script is not appearing because you have an error in OnStateChange.

                12/6/2018 3:58:56 PM Default Strategy 'mtsb': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.

                May I confirm you viewed the Log tab of the Control Center to look for errors?
                Chelsea B.NinjaTrader Customer Service


                  I have seen now the log Tab and appears that error you are showing me.
                  I have made "save as..." different names and times the original "mts" script.
                  The problem comes from here.
                  All the copies from the original mts have a problem.


                    Hello Parmenides48,

                    What is the specific error you are seeing?

                    If the script is having an error early on, that would explain why it is not shown in the list. The error would need to be corrected before you could continue. The SaveAs will persist an error to a copy of the script as well, so you need to address the error first.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service


                      Hello again.
                      The problem is when I change the definition of sr variable.
                      When I code:
                      public SR sr = new SR();
                      there is no problem.

                      But if I change that definition, and code this one:
                      public SR sr; // instead of define sr as an object I define that as a variable of SR type.

                      and compile, appears the error " error calling the On State Change method.......",
                      and for this reason the strategy doesn´t appear as available when I try to insert to a chart.

                      Now I am going to work on it,
                      trying to create a code for the purpose I want to.
                      Thanks for all.


                        Hello Parmenides48,

                        Thank you for the additional details.

                        Yes, it sounds like this is likely just a standard error relating to the objects being used. The error being in OnStateChange tells you the location of the problem, so you would just need to isolate which object is causing the error.

                        If this is caused by changing the public SR variable, which you likely don't need by the way, this is very likely that the object is just null because you removed the = new SR() part in your description.

                        If your intention is to create a new SR object for each list entry, you very likely don't need to make a public SR property at all and just need to create the new SR object when you insert it into the list.

                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service


                        Latest Posts


                        Topics Statistics Last Post
                        Started by ct, Today, 12:48 PM
                        4 responses
                        Last Post eDanny
                        by eDanny
                        Started by BrandonT1292, 07-30-2018, 07:32 PM
                        9 responses
                        Last Post NinjaTrader_PatrickG  
                        Started by kujista, Today, 12:12 PM
                        1 response
                        Last Post NinjaTrader_Jesse  
                        Started by drewski1980, Today, 11:08 AM
                        1 response
                        Last Post NinjaTrader_Jim  
                        Started by neoikon, Today, 11:20 AM
                        2 responses
                        Last Post neoikon
                        by neoikon