Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pasted into new strategy -- Now it won't work

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

    Pasted into new strategy -- Now it won't work

    In the ninjatrader 8 editor I pasted part of one strategy into a new one under the namespace which I did not change. It compiled with no errors but it does not show when I attempt to run the strategy in a chart. The name of the strategy that I copied from is now duplicated but does not run. I wanted to keep the old strategy for access to more of it while testing the new one. How can I remedy this? thanks for any advice

    #2
    Hello ronaldgreene828,

    Thanks for your post.

    It sounds like you may have a naming conflict. There are 3 areas of a script that should match and be unique compared to other scripts.

    1) Name of the file, this is what the Ninjascript editor uses to open the source code file.
    2) The Public class name
    3) The "Name = field in OnStateChange() in State.SetDefaults (this is what the Open Strategy dialog box will use)

    In any file, you would want all 3 to be the same.

    For every script, all 3 need to be different from any other script.

    Comment


      #3
      Thanks, I found the source file and the name is correct. The public class name is correct and I changed the "Name = field" to read correctly. The strategy shows up and I'm able to run the strategy, but the user inputs do not show. I searched through the source file to find a reason for this but found nothing. I also checked the default file in the template folder and found nothing.

      Comment


        #4
        Hello ronaldgreene828,

        Thanks for your reply.

        In the new strategy do you have public properties?

        In your original, these are likely found under "#Region Properties"

        Comment


          #5
          I found "Properties" in the last lines of the old strategy. When moving the cursor over it, it says #Region Properties and I can open it. I copied and pasted this at the end of the new strategy and now old user inputs appear when I run the strategy. I see that I'll need to manually insert new inputs into #Region Properties that I have in the new strategy.

          Comment


            #6
            Hello ronaldgreene828,

            Thanks for your reply.

            Yes, and you will need to use State.SetDefaults to populate the default for the input. the old strategy likely demonstrates this.

            Comment


              #7
              Ok, I did that. I set the default value in State.SetDefaults with the other variables and it's working, thanks.

              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
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              72 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