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

Walk-Forward Custom Fitness (How to Eliminate Negative Optimizations) ?

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

    Walk-Forward Custom Fitness (How to Eliminate Negative Optimizations) ?

    Dear all,

    Is there a way to make the Walk-Forward process to only Forward-Test the Parameters that had a Positive Net-Profit on the optimization?


    for example:

    Optimization Result # 1 (Best Parameters 5/3/5) +$1000 ==> Forward-Test.
    Optimization Result # 2 (Best Parameters 5/2/1) +$2500 ==> Forward-Test
    .
    Optimization Result # 3 (Best Parameters 2/9/6) -$1700 ==> Don't Forward-Test.
    Optimization Result # 4 (Best Parameters 4/2/3) +$2500 ==> Forward-Test
    .
    Optimization Result # 5 (Best Parameters 2/8/7) -$4000 ==> Don't Forward-Test.


    PHP Code:
    protected override void OnCalculatePerformanceValue(StrategyBase strategy)
    {
           Value = strategy.SystemPerformance.AllTrades.TradesPerformance.NetProfit;
    } 
    

    Thank you.

    #2
    Hello PrQuantumH,

    Thank you for your post.

    I am not aware of a way to make the walk forward optimization only process parameters that had a positive net profit. You could set the optimizer to optimize on max net profit, though there is no way to stop forward testing if the max net profit is a negative number. I have submitted this as a feature request to the Development Team. I will follow up with an internal tracking number for your reference as soon as it is created.

    Thanks in advance for your patience.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thank you Emily. I would really appreciate adding this feature.

      Currently, I'm thinking of coding a workaround for it. Is there a way to know from inside the strategy script (or from the custom Fitness Script) that the currently running test is categorized as Optimization or as a Backtest (Forward-Test).

      The initial idea would be, coding a global variable that can allow the next use of the strategy (for a backtest Forward-Test) only if the previous use of the strategy (Optimization) was having a positive Net-Profit.

      Regards,

      Comment


        #4
        Originally posted by PrQuantumH View Post
        Thank you Emily. I would really appreciate adding this feature.

        Currently, I'm thinking of coding a workaround for it. Is there a way to know from inside the strategy script (or from the custom Fitness Script) that the currently running test is categorized as Optimization or as a Backtest (Forward-Test).

        The initial idea would be, coding a global variable that can allow the next use of the strategy (for a backtest Forward-Test) only if the previous use of the strategy (Optimization) was having a positive Net-Profit.

        Regards,
        Hello,

        Thank you for your note.

        Though it is not documented not supported, there is a StrategyBase.Category enum that may be used to determine which mode the strategy is running in from within the Strategy Analyzer. This is mentioned in the following forum post:


        You could try using this in your workaround, though we are unable to guarantee the behavior of using this in your strategy.

        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hello PrQuantumH,

          Thanks for your patience.

          The internal tracking number for your feature request is SFT-6043. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

          When a feature request is implemented, you'll find a description of the new feature in the release notes:Thank you for using NinjaTrader.​
          Emily C.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PrTester, 12-29-2008, 05:27 PM
          131 responses
          96,700 views
          0 likes
          Last Post diegomezhur  
          Started by knowmad, 05-07-2024, 03:52 AM
          6 responses
          62 views
          0 likes
          Last Post knowmad
          by knowmad
           
          Started by xepher101, 05-10-2024, 12:19 PM
          9 responses
          115 views
          0 likes
          Last Post jeronymite  
          Started by tkaboris, Today, 07:53 PM
          0 responses
          4 views
          0 likes
          Last Post tkaboris  
          Started by JGriff5646, Yesterday, 05:47 PM
          2 responses
          23 views
          0 likes
          Last Post JGriff5646  
          Working...
          X