Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Contract sizing during walkforwad backtesting

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

    Contract sizing during walkforwad backtesting

    Hi,

    When doing a walkforward backtest on historical data, I want to use my strategy to determine the contract sizes to trade.

    The contract size should be determined by the cumulative profits during the TEST period of the walkforward optimisation however, the cumulative profit is also being calculated during the OPTIMISATION period of the walkforward simulation.

    Is there any way I can calculate contract size during the TEST period of walkforward
    optimation only?

    I guess I'm looking for a strategy command such as "Performance.RealtimeTrades.Currency" for the TEST period only.
    Any suggestions?

    #2
    Hello,

    Thanks for your note.

    The same code will run during walk forward optimization and optimization phase. There is no way to separate out code to run one or the other unfortunately as this code would be unable to run live since it would have to be customized to run in optimization runs only which is not the intent of the strategy analyzer.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      How does one then test for contract size optimisation?

      Comment


        #4
        Hello,

        You would need to use a variable to specify your size that you use for your EnterLong and EnterShort. Then set this variable up as a parameter so that you can optimize it.



        Then on your EnterLong() call you need to use a override /version that includes QTY.



        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X