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 sidlercom80, 10-28-2023, 08:49 AM
          173 responses
          2,336 views
          0 likes
          Last Post intelligenttrader  
          Started by ArkansasClint, 04-25-2024, 09:28 AM
          1 response
          23 views
          0 likes
          Last Post Leafcutter  
          Started by NM_eFe, Today, 06:14 AM
          0 responses
          5 views
          0 likes
          Last Post NM_eFe
          by NM_eFe
           
          Started by sgordet, Today, 06:04 AM
          0 responses
          4 views
          0 likes
          Last Post sgordet
          by sgordet
           
          Started by bc24fl, 08-30-2019, 01:58 PM
          4 responses
          260 views
          0 likes
          Last Post PaulMohn  
          Working...
          X