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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X