• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimizer Pre-Conditions

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

    Optimizer Pre-Conditions

    Is there any way to enforce pre-conditions during an optimization?

    For example, say I want to optimize the period of a couple of moving averages:

    #1 SMA (2,20,1) (Fast moving average Period 2-20)
    #2 SMA (10, 50, 1) (Slow moving average Period 10-50)

    There is a range of values that overlap between the two moving averages (10-20). However I do not want to run the iterations where the fast period is greater than the slow period.

    Is there any way I can add a pre-condition; or instruct the optimizer from code to abort an interation and to skip to the next one.

    if(FastPeriod > SlowPeriod) {
    // Skip this Iteration
    }

    #2
    Hello kevinenergy,
    Thanks for your post.

    You could limit your strategies logic to only process when that condition is true or returning if it is false. Something like the following snippet at the top of your script would do the trick.

    Code:
    if (SMA(fastPeriod)[0] > SMA(slowPeriod)[0]) return;
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hey Josh, thanks for responding. I think you misunderstood my question. I'm not looking to skip strategy logic when the value of a moving average is something. I Want to make the optimizer not run an iteration when the Parameters are some value.

      Just trying to save time on an Optimization run, so that its not processing parameters I know that will not produce good results.

      Comment


        #4
        This is not something that there will be a setting for in the Optimizer. As far as I know your only option would be a workaround like what I described.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kweiss, Today, 08:35 PM
        0 responses
        1 view
        0 likes
        Last Post kweiss
        by kweiss
         
        Started by zulok, Today, 05:02 PM
        0 responses
        6 views
        0 likes
        Last Post zulok
        by zulok
         
        Started by Andreas M., Today, 04:42 PM
        0 responses
        3 views
        0 likes
        Last Post Andreas M.  
        Started by sidlercom80, Today, 12:29 PM
        2 responses
        24 views
        0 likes
        Last Post fx.practic  
        Started by itrader46, Today, 02:49 PM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X