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 alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        18 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        5 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        40 views
        0 likes
        Last Post love2code2trade  
        Started by junkone, Today, 11:37 AM
        3 responses
        26 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X