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

How to save/load indicator parameters?

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

    How to save/load indicator parameters?

    Has anyone come up with a way to save/load indicator and strategy parameters? If I have a complex indicator with several combinations of parameters I want to use, I would like to save those combinations somehow and be able to restore them into the indicator so I don't have to manually change each parameter. Is this possible?

    Thanks!
    Bryan
    cassb
    NinjaTrader Ecosystem Vendor - Logical Forex

    #2
    Hello,

    You will need to alter the code within the indicator/strategy: Tools>Edit>Indicator>select the indicator>OK>right click Save as and save the indicator under a different name>double click the word Variables near the top of the code>change the value to the right of the "=" sign that corresponds with your input parameter>right click>Compile>Close the indicator code by clicking on the x in the right hand corner.

    You will need to do this for each parameter setting you want to save.
    DenNinjaTrader Customer Service

    Comment


      #3
      Basically if you want saved parameters you will need to change the default parameters for the NinjaScript. There is no "loading" of parameters. What Ben is suggesting is you can create yourself several instances of the same NinjaScript with varying parameter loadouts. That will allow you to pick and choose which one you want to use at which point in time.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Josh View Post
        Basically if you want saved parameters you will need to change the default parameters for the NinjaScript. There is no "loading" of parameters. What Ben is suggesting is you can create yourself several instances of the same NinjaScript with varying parameter loadouts. That will allow you to pick and choose which one you want to use at which point in time.
        OK thanks... yes, I don't want 10 different variations of the same indicator code. I just want one indicator and several parameter files to load into it. OK, we'll work something out, thanks!

        Bryan
        cassb
        NinjaTrader Ecosystem Vendor - Logical Forex

        Comment


          #5
          Originally posted by cassb View Post
          OK thanks... yes, I don't want 10 different variations of the same indicator code. I just want one indicator and several parameter files to load into it. OK, we'll work something out, thanks!

          Bryan

          Hi Bryan,

          you could save your parameters to a file and read it back from that file. There are some official code examples available how to use stream - read/write. The save location for writing to a file is the dispose-method, and for reading from that file the first time OnBarUpdate() is called. If this is to late you could also read at Initialize(). Be aware, Initialize() could be invoked several times, because your indicator could be instantiated several times, before the one appears which is starting OnBarUpdate().

          If you are an experienced programer you could try to expand the context menu for save/load configuration.

          Regards
          Ralph

          Comment


            #6
            Hi cassb,
            You could also create different chart templates for the indicators and settings...
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rocketman7, Today, 09:41 AM
            4 responses
            15 views
            0 likes
            Last Post rocketman7  
            Started by selu72, Today, 02:01 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by WHICKED, Today, 02:02 PM
            2 responses
            12 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Started by Mikey_, 03-23-2024, 05:59 PM
            3 responses
            54 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Working...
            X