Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Template

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

    Strategy Analyzer Template

    I am trying to select a stategy template based on what kind of configuration I have set for my strategy.

    My experience level is as follows:
    • I know how to save and load a template for any chart I want. (Those templates are listed in NT7/templates/Chart.)
    • I know how to save and load a template for the Market Analyzer. (Located in NT7/templates/MarketAnalyzer).
    • I know how to build and save a Chart Series like a BetterLineBreak and select that from within NT. (NT7/templates/ChartSeries)
    • I know how to build a SINGLE template for the Strategy Analyzer, but only one and it has to match the name of the strategy.
    • I know how to build my own Strategy Optimizers and Strategy Methods.
    • I know how to build strategies and indicators.
    What I don't know is, how to build various different templates for my strategy to select from the Strategy Analyzer. I have looked through the XML file and can't find any clue or hint.

    I realize building strategies and testing them is kind of fringe stuff for NT based on the sketchiness of the help file. I am thinking there is a command I can add to my strategy, or to the strategy method that would allow me to select the template of my choice.

    Any thoughts?
    Gordo

    #2
    addition

    I forgot to add, we know how to get the parameters out of the Strategy Analyzer by running a strategy that writes to a file. I can then use this file to run a stategy with parameter setttngs from the file I created in the Strategy Analyzer.

    The problem I am trying to solve is how to get the Strategy Analyzer to read a file into the Strategy Analyzer so I don't have to type in all the settings every time I want to do an optimization or a back test.

    Gordo

    Comment


      #3
      Hi Gordo,

      Building and testing strategies is a common NinjaTrader activity and not exactly fringe. Strategy templates work like this: Once you setup the strategy settings the way you want: Right click > Save as Default for strategy name. The next time you use the strategy with that name, it will load with those settings. Strategy templates are specific to the named strategy you're using and there is only one default per strategy allowed.

      I think what you're looking for is capability to select a strategy template from a drop down menu, which is not available.
      Ryan M.NinjaTrader Customer Service

      Comment


        #4
        Ryan

        I think you misunderstood what I was looking for and I was not trying to offend regarding the NinjaTrader program. I have been using NT for years now and am very satisifed. My 'fringe' comment was regarding how to code OptimizerTypes and OptimizerMethods. There is no help (F1) available for that work.

        Here is what I get from NT help for DefaultOptimizationMethod:

        This section is under construction however, if you are an advanced C# programmer you can see the file Documents\<NinjaTrader Folder>\bin\Custom\Type\@DefaultOptimizationMethod.cs.

        What I was trying to say in my previous post is I do know some C#, what I don't know is where to look for the parameters.

        I am not looking for a drop down selection like those available in the chart templates or data series. What I am looking for is a way to programically invoke the code that sets the default for the Strategy Analyzer optimizer or backtester.

        Should I be looking at the following lines of code from the Optimization Method? (This is from @DefaultOptimizationMethod):

        public override object Clone()
        {
        DefaultOptimizationMethod ret = new DefaultOptimizationMethod();
        ret.Parameters = (ParameterCollection) Parameters.Clone();

        return ret;
        }

        I believe ParameterCollection is just C# stuff, but I was hoping to get a clue from you guys on where to look, or how to attack this problem.

        Hope you're not sore, that was not my intent, but I really could use a little help here.
        Gordo

        Comment


          #5
          The help guide you reference is for programming your own type, and is intended for experienced programmers. Yes, this activity might fall on the fringe for what people use NinjaTrader for. To develop your own optimization type, you can work from the existing ones. The source code is available at the path indicated.

          What I am looking for is a way to programically invoke the code that sets the default for the Strategy Analyzer optimizer or backtester.
          From the description you write, it doesn't seem that programming your own optimization type is what you're looking for though. You can code in properties in Initialize() that serve to populate the initial selections made when backtesting or optimizing. A couple examples:
          EntryHandling = EntryHandling.UniqueEntries;
          ExitOnClose = false;

          Is that what you're looking for?
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Actually, I am a bit beyond that level.

            I have a generic strategy that I use with all sorts of different instruemts and chart types that has 100+ numeric variables, plus some 20+ non-numeric variables that have sub choices (like the choice of an SMA or WMA for the moving average or wether to use a CCI or an ADX, etc.). The strategy runs well, and I am able to save the settings I find with the optimizer to a text file with a text writer. Then when I run the strategy on a live data feed, I simply type in the text file name when I enable the strategy and it reads my text file settings back into the strategy and runs. I could do this with an XML file if I needed to, but have not had that need up to this point.

            Basically, my strategy isn't a strategy at all, but a shell for the parameters that define the strategy.

            My problem is I want to read the file into the optimizer like I can read it into the strategy when I enable it. I don't want to have to enter in all that strategy information (120+ entries) everytime I want to work with the optimizer and tune my various 'strategies'. It's just a pain.

            I hope I am making sense here.

            Comment


              #7
              I see -- Thanks for the reply. For saving defaults, the only option available is right click > Save as Default. There's no other way to tell NinjaTrader that you would like to use those settings again.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                gbrest,

                Could you please share the code by which you are able to save the settings found with the optimizer to a text file, and then type in the text file name when enable the strategy, and the strategy reads the text file settings back into the strategy and runs.
                This is exactly what I've been looking for.

                tnx,

                Comment


                  #9
                  bkool, still working on the program. It will be available soon at midwestindicator [dot] com. Thanks for the interest.

                  Comment

                  Latest Posts

                  Collapse

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