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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            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.
                JesseNinjaTrader Customer Service

                Comment


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

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by TradeSaber, Today, 07:18 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post TradeSaber  
                  Started by PaulMohn, Today, 05:00 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post PaulMohn  
                  Started by ZenCortexAuCost, Today, 04:24 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by ZenCortexAuCost, Today, 04:22 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by SantoshXX, Today, 03:09 AM
                  0 responses
                  17 views
                  0 likes
                  Last Post SantoshXX  
                  Working...
                  X