Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom strategy not appearing in available strategies list

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

    Custom strategy not appearing in available strategies list

    Hello. Brand new to creating scripts. When trying to add a strategy to a chart, my custom strategy doesn't appear in the list of available strategies. 1st picture is the CTRL+S dialogue (from an ES chart). 2nd shows the list of strategies in the right margin (highlight added) and the compiled ESReversals script.
    Thanks!

    Solved: looked in the "log" tab as suggested in another post and found I was getting a run time error. This prevents the script from showing up in the list. Fixed now.
    Last edited by Sigma Cypher; 01-08-2022, 06:55 PM. Reason: Edit: The log showed an error related to a draw command. I removed the draw command and the script appeared in the list.

    #2
    Hello Sigma Cypher,

    Are any error messages appearing on the Log tab of the Control Center when opening the Strategies window? (Errors in OnStateChange when State is State.SetDefaults would prevent an instance of the script from being created to list in the Strategies window)

    If so, what is the full error message?

    What line of code is causing the error?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes, there was an error message in the log. I tried to draw a line in the OnStateChange() method, which is not allowed -- it has to be in OnBarUpdate(). You can delete this post if you like, I just edited it in case someone else ran into this problem.

      Comment


        #4
        Hi, please help, what if I have the same problem but I don't get any error messages in Log tab?

        Comment


          #5
          Hello naruti,

          Has the script compiled without any compile errors in the NinjaScript Editor?

          Does the Name property set in State.SetDefaults match the classname and filename?

          Can you export the file and let me 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 Add-on...
          2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
          3. Click the 'Export' button
          4. Enter the script name 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.
          http://ninjatrader.com/support/helpG...nt8/export.htm
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi Chelsea,

            So yes, I have compiled zip file. Where should I send it for you to test it?

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello naruti,

              Has the script compiled without any compile errors in the NinjaScript Editor?

              Does the Name property set in State.SetDefaults match the classname and filename?

              Can you export the file and let me 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 Add-on...
              2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
              3. Click the 'Export' button
              4. Enter the script name 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.
              http://ninjatrader.com/support/helpG...nt8/export.htm


              Hi Chelsea,

              So yes, I have compiled zip file. Where should I send it for you to test it?​

              Comment


                #8
                Hello naruti,

                Can you attach this to your next post? (Click the upload attachments button when replying)

                If you would like to take the conversation private, you can email scriptingsupport [at] ninjatrader [dot] com and include a link to this forum thread.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello naruti,

                  Can you attach this to your next post? (Click the upload attachments button when replying)

                  If you would like to take the conversation private, you can email scriptingsupport [at] ninjatrader [dot] com and include a link to this forum thread.
                  Hey, I just sent an email with the script attached to your provided email address.

                  Thank you!

                  Comment


                    #10
                    Hello,

                    I am also having this issue. Do you mind taking a look at mine as well?

                    Comment


                      #11
                      Hello Tbryant,

                      Welcome to the NinjaTrader forums!

                      Yes, if you would like me to check the items in post # 5 (run-time errors on the Log tab, Name property / class name / file name matching), please post an export of the script, or email us at scriptingsupport [at] ninjatrader.com.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hey Chelsea,

                        This is a slightly different issue, but it relates to this topic. And will likely to be useful to people on this thread. I've searched the forum & documentation and haven't found a clear answer. I am able to put my strategies in "NinjaScript Editor" into their own folders with no issues. There are also no compile issues & nothing shows up in the log. I have always used NS Editor to create the folders & move strategies into them. And I have not modified the filesystem directly.

                        However, when I go to "Strategy Analyzer" they do not group themselves into separate folders as expected unless I also change the namespace of strategy for example to "NinjaTrader.NinjaScript.Strategies.MyStrats". I've yet to run into any issues doing it this way, but the warning msg at the top "//This namespace holds Strategies in this folder and is required. Do not change it." worries me a little as I might have future issues down the line? I personally do not foresee any issues as most of the Strat functionality seems to be inherited from the Strategy Base Class & declarations. But I am new to NT & C#.

                        Is this an acceptable way of organizing my strategies in "Strategy Analyzer"? Or is it possible to do this without modifying the namespace?

                        Thanks for your time, Marcis!



                        Comment


                          #13
                          Hello Marcis,

                          This is expected behavior. Unfortunately the Strategy Analyzer Strategy drop-down cannot show folders.
                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by NullPointStrategies, Yesterday, 05:17 AM
                          0 responses
                          54 views
                          0 likes
                          Last Post NullPointStrategies  
                          Started by argusthome, 03-08-2026, 10:06 AM
                          0 responses
                          131 views
                          0 likes
                          Last Post argusthome  
                          Started by NabilKhattabi, 03-06-2026, 11:18 AM
                          0 responses
                          73 views
                          0 likes
                          Last Post NabilKhattabi  
                          Started by Deep42, 03-06-2026, 12:28 AM
                          0 responses
                          44 views
                          0 likes
                          Last Post Deep42
                          by Deep42
                           
                          Started by TheRealMorford, 03-05-2026, 06:15 PM
                          0 responses
                          49 views
                          0 likes
                          Last Post TheRealMorford  
                          Working...
                          X