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

Strategy Optimizer Catch-22

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

    Strategy Optimizer Catch-22

    I keep running into situations where the optimizer is treating a case where 0 trades made gives a profit factor of 1 and when including or using maximum profit factor for the target, this occurs frequently. The problems lies in this will only happen on one side of the trades (long or short), but my strategy will function wildly different when executing both sides of trades (that is what I am targeting).

    If the default case of 0 trades being made resulted in a profit factor of 0, this wouldnt occur. (Generally what happens is one side of the trades fall off, and the other side are optimized to the point where a very high win rate occurs (95%) for a handful of trades over a multi-year backtest, resulting in a very high profit factor).I have a large set of inputs for optimization and use the genetic optimizer over brute force, and have generally good results using Max net profit, but when I fine tune I like to move to multi-target optimization and the default case for 0 trades = 1.0 profit factor is something that I feel like is easily fixed, so I wanted to pose the question on whether this is truly intended behavior.

    It may be true that in the event I am running into, a profit factor of 0 wouldn't prevent this case from popping up.

    #2
    Hello BraisedInBlue,

    Welcome to the NinjaTrader forums!

    Is the issue there were no trades?

    Or is the issue that the profit factor is 0?

    The profit factor is the gross profit divided by the gross loss.

    When the value is 0, what is the gross profit and gross loss reported?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The issue is that when no trades have occurred the calculated profit factor is 1.0, not 0.0. So if you optimize for Max profit factor, there is a chance that my strategy will get one side of its trading strategy (long/short) essentially disabled by the optimizer. This happens because it then enables the other side of the trading scheme to have a really high profit factor (usually a very low trade count over multi year period).

      Comment


        #4
        Hello BraisedInBlue, thanks for your reply.

        The "Optimize on" parameter will only affect the backtest list that is displayed at the end of an optimization. The 0 trade backtest would show up at the top of the list due to its profit factor of 1, but the other backtests that actually took more than 0 trades would be the backtests of importance.

        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        53 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        32 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        5 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        19 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        6 views
        0 likes
        Last Post cre8able  
        Working...
        X