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 algospoke, 05-13-2024, 06:53 PM
          4 responses
          28 views
          0 likes
          Last Post algospoke  
          Started by dtl-saw, 12-29-2022, 09:12 AM
          46 responses
          3,177 views
          1 like
          Last Post sonia0101  
          Started by AlphaOptions, 06-18-2013, 08:24 AM
          7 responses
          2,186 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by FAQtrader, 04-25-2024, 12:00 PM
          14 responses
          213 views
          0 likes
          Last Post sonia0101  
          Started by bsbisme, Today, 05:08 PM
          0 responses
          8 views
          0 likes
          Last Post bsbisme
          by bsbisme
           
          Working...
          X