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

Saving strategy settings ...

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

    Saving strategy settings ...

    I have a custom strategy with many settings, and these settings differ depending on the instrument the strategy is run on. When I want to enable the strategy on a new chart, I have to go through the error-prone task of setting each setting to its correct value for that instrument...

    Is there an open-source code snippet available that will allow me to save the settings for a given instrument? So that I can simply load say "SPY settings" next time I want to run the strategy on a new SPY chart...

    Thanks.

    #2
    Hello,

    Thank you for the question.

    By default a strategy can have one set of defaults by right clicking in its properties and setting those settings as default.

    You could load data based on a Property you set in the strategy. For example if you have a String input, you could type in the name of the file and it could load that file and apply settings.

    There is no complete sample of this process, but you could use the following example of Writing data to file and Reading data from file to accomplish this type of task. :



    You could also look into using Serialization and Deserialization to save structured data like an object to an xml file and then restore that data. This is not a topic NinjaTrader support could assist with but instead would be a general C# concept you could research.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Saving Strategy Settings

      Originally posted by AnotherTrader View Post
      I have a custom strategy with many settings, and these settings differ depending on the instrument the strategy is run on. When I want to enable the strategy on a new chart, I have to go through the error-prone task of setting each setting to its correct value for that instrument...

      Is there an open-source code snippet available that will allow me to save the settings for a given instrument? So that I can simply load say "SPY settings" next time I want to run the strategy on a new SPY chart...

      Thanks.
      Can someone from NT Support respond to this? Thanks.

      Comment


        #4
        Hello,

        Thank you for the post.

        The post #2 in this thread was the reply to the original posters question from our support. Unfortunately, there is nothing I could provide in addition to the previous answer.

        The platform is only capable of storing 1 Default settings template for each script. If this is too limited, you would need to design your own save/load system for additional templates that are built into your custom item. This is a concept that we do not have any samples of so there would not be anything more I could provide on this subject.

        Post #2 highlights some possible ways you could accomplish a save/load system from a custom item.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        7 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        6 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X