Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

change parameters of a strategy while its in motion

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

    change parameters of a strategy while its in motion

    is there a way to change parameters of a strategy while its in motion? for example the stop value ? or the number of periods of SMA without stopping the strategy?

    #2
    Hello,

    Thank you for the question.

    While the strategy is running the user interface properties you see in the strategies menu would be disabled and would be expected. Unfortunately there is no way from the Properties menu its self to edit these values while the strategy is enabled. Only the strategies code could change the variables from that point on.

    I look forward to being of further assistance.

    Comment


      #3
      How Can I change or enter the new values in a variable through the code of the strategy?

      Can you give me an example of how to change the code and what could change on these values?

      Thanks

      Comment


        #4
        Hello,

        If you are using a script that has a Public property, lets just say your script has a "Period" property.

        Initially you set the Period to 10 from the user interface.

        In OnBarUpdate you have a condition:

        if(Close[0] > Close[1])
        Period = 33;

        In this case, when the Close is greater than the Open of the prior bar, the Public property Period was changed to 33, this is the same property from the user interface but changed via script.

        If you then re open the strategy menu it would likely reflect the new value but to be absolutely sure you could use a Print(Period) to print the value of the property in OnBarUpdate. This would show the change as it happened.

        I look forward to being of further assistance.

        Comment


          #5
          Ok I understand, but in this case the new value was scheduler in the code.

          I can not to change manually, externally, the value of the Period?

          While the strategy is running is not possible to change the value of the Period manually?

          Thanks

          Comment


            #6
            Hello,

            Yes this is correct and expected, the user interface would be disabled while the strategy is running.

            There are no documented ways to do this but other users have used undocumented code to create custom buttons or other interface items to change values in the strategy which added the button as an example.

            These types of topics are not one we can assist with through support though because you are essentially just developing in C# at that point and doing modifications to the user interface which can be complicated or cause errors if not done correctly.

            The simple answer is no this is not possible, the more detailed and complicated answer would be its certainly possible but would require a fair knowledge of C# winform application design to accomplish this.

            I look forward to being of further assistance.

            Comment


              #7
              I understood , thank you for the prompt response. Can you point me in the right direction on where I might find more information or even an example of this in practice ?
              Thanks in advance for all the support !

              Comment


                #8
                Hello,

                For NinjaTrader 7 there are not many items I could provide, there is a lot of information spread throughout the forum on more specific topics.

                One item you could look at is the Toolbar shortcut indicator, that creates a toolbar and assigns buttons to that toolbar in a chart. Its a good first step to understanding Controls in C# and how to modify the interface.



                I look forward to being of further assistance.

                Comment


                  #9
                  Thank you for your help. I will see this code.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  561 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  325 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  547 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  547 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X