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

Launch Optimizer from Strategy? Self optimize a strategy?

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

    Launch Optimizer from Strategy? Self optimize a strategy?

    I would like to build a strategy which would review the trading results in the last hour, launch the optimizer, analyze the performance in the last hour and adjust parameters to use the best set of parameters obtained in optimization.

    Let use a simple example on Moving average crossover system.
    Lets trade using 1 min charts.
    On lunch of strategy, I would like to programmatically activate backtester and see what would be the best combination of MA crosses in the last hour.
    Then I would like to use results of optimization and use those parameters.
    After an hour of live trading , I would like to repeat optimization and adjust my moving averages again.

    Is there a way of doing this with Ninja trader? Nija Trader 8?
    Can I initite backtest optimization programmatically and pick up the results?

    I understand that solid C# programing ability would be required.

    How to conver a simple moving average crossver system into a self optimizing system which will set new moving average parmeters every hour

    //btypical Example #1
    // If an open position already exists, subsequent EnterLong() calls are ignored.
    protected override void Initialize()
    {
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    }

    protected override void OnBarUpdate()
    {
    if (CrossAbove(SMA(10), SMA(20), 1)
    EnterLong("SMA Cross Entry");

    if (CrossAbove(RSI(14, 3), 30, 1)
    EnterLong("RSI Cross Entry);
    }

    #2
    Hello astef,

    Thank you for your post.

    I am sure there might be some very obtuse idea that would allow for the Strategy Analyzer to be launched from a strategy. However, if I was going to undertake this task I would create my own optimization that can be ran and adjust parameters (such as periods for the SMAs).

    So instead of launching the Strategy Analyzer I would loop through the data and calculate my own performance values and base the parameters off of those performance values.

    A major item here though is performance. Whether you figure out how to launch the Strategy Analyzer in NinjaTrader 7 or 8, or you develop your own logic for optimizing the parameters, it is going to be taxing on your system resources and I would not really recommend this approach.

    As a suggestion, you could simply run your optimizations each day (before or after your markets open or close) and then adjust the strategy before enabling it for the next session.

    Please let me know if you have any questions.

    Comment


      #3
      Hi Patrick

      Thank you for your suggestion.


      I see the following program

      @DefaultOptimizationMethod.cs

      how that is launched - is this a link to launching strategy optimizer?

      I still would like to lunch a backrest for a particular strategy with set of parameters and review the results programmatically.
      Last edited by astef; 11-12-2015, 06:36 AM.

      Comment


        #4
        Hello astef,

        That files is the optimization type not the actual Strategy Analyzer. You can create optimization types using that file as a reference, but these are selected through the Strategy Analyzer.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        2 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        945 views
        0 likes
        Last Post spwizard  
        Working...
        X