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

Custom Optimizer

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

    Custom Optimizer

    Hello

    I am trying to develop a custom optimizer and am having some trouble calling and using the function RunIteration().

    Is it possible to get more information about what this function does or the code behind it?

    Can it be called with input arguments?

    Can it be looped? For example:

    RunIteration() with one set of inputs,
    Get results,
    Then RunIteration() with another set of inputs, and
    Get results.

    Is this possible?

    Ideally I would like to run a multi-thread approach and pass multiple arguments to
    RunIteration(). I image this could be done through a GPGPU set up such as CUDAfy.

    As I understand global parameters are stored and then RunIteration() back tests each of these parameters and then ranks the results?

    Is there a way to call the straight back test method through code? And then loop through with different input arguments?

    Thank You

    #2
    Hello,

    Thank you for the question.

    I have put in a note to see if there can be expanded descriptions of the items in this section, currently there is limited documentation on these items.

    Regarding RunIteration(), this method has no overloads so it could not pass a parameter, I am a little confused on this question though. RunIteration() simply calls the next iteration, are you asking how to persist a value from one iteration to the next to allow it to be used in the next iteration?

    As for calling the backtest outside of this type, currently there are no documented ways to do a backtest without using the backtest tool, I will put in a feature request to see if this could be utilized from code.

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

    Comment


      #3
      Hi Jesse,

      Thank you for your help.

      In simple psuedocode this is what I would like to do:

      Strategy:
      Have a parameter in a strategy to optimize e.g. int 1 = 1

      Optimizer:
      Loop through the backtests with different settings for the parameter.

      for i = 0; 1 < 1000; i ++
      run backtest(i) - with parameter set to i
      recordResults[] = resultsBacktest(i)

      But to be able to mult-thread (ideally via GPGPU) and run the back tests with different settings for the optimization parameter simultaneously.

      Can this be achieved via the RunIteration() function and how can the results of each run be captured and recorded?

      Ideally it would be best to be able to call the backtest directly. For example the strategy parameters seem like they are just arguments to the strategy. For example:

      strategy1(parameter 1, parameter 2)

      And the strategy seems like it should just be an argument for the backtest. For example:

      backtest(strategy1(parameter 1, parameter 2)

      If it could be called this way it would be very easy to loop through. For example:

      for i = 0; i < 10; i ++
      for j = 0; j < 10; j++
      backtest(strategy1( i, j ))

      How every there is little information on being able to call the backtest or iteration functions or on how to capture and record the results for them.
      Last edited by Aether; 05-04-2016, 09:10 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        I wanted to further clarify this response.

        Based on what you are describing, I believe you are asking how Optimizer types would relate to completing an entire backtest and then utilizing the results of that test to essentially start another. Is this correct?

        The Optimizer type would simply control how the properties are incremented not control the entire backtest. The RunIteration method is simply letting the analyzer know to start the next iteration because the logic in the Optimzer has incremented the properties. The analyzer window would essentially be controlling the test and utilizing the Optimizer to control its increment for optimization.

        What you are asking would not currently be possible because there are no methods to complete a backtest without the actual backtest window, or no NinjaScript way of doing this anyway. I will submit a feature request for this item though.

        Regarding the remainder of the post about putting work off to the GPU, you could certainly try utilizing the GPU but this would be a subject that our support would not really be able to provide any helpful information on due to this being a third party library.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        0 responses
        3 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        8 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        4 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X