Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose at end of backtest

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

    ExitOnClose at end of backtest

    Hello

    When running BackTest on a strat, i see that there is an automatic ExitOnClose when the backtest reaches the last bar of the backtest.

    Is it possible to disable this ? Would be nice to have it as an option.

    #2
    Hi zark.be, correct this is expected behavior. The only option would be the ExitOnClose setting, which applies to flatten the strategy at the session end times.

    Comment


      #3
      Thanks for the quick response Bertrand.

      But even though my ExitOnClose is set to false. it still closes the positions.
      It's kinda disturbing my numbers.
      I'd rather see a "Open positions" and a "Unrealized PnL" rather than have it close all positions.
      Since those positions exits do not follow the logic of my strategy, i'd rather not have them.

      Please consider adding an option to the backtest dialog ! (or at least a variable in the initialize() method).

      Comment


        #4
        Are you referring to closing positions at the end of the backtest?

        With ExitOnClose set to False you should be staying in overnight though (depends of course also on your trading strategy logic).

        Comment


          #5
          i just knew i wouldn't express myself correctly.

          yes, i'm talking about the last last last last bar in a backtest.

          here's a screenshot.


          ExitOnClose is set to false, and doesn't close at the end of the day (as expected).

          BUT closes at the end of the backtest
          Attached Files

          Comment


            #6
            Ok, this is expected since it does this to calculate the backtesting statistics for your strategy. So you would like an option to exclude any still open trades from the backtest results?

            Comment


              #7
              Indeed.
              I would like to have an option for that "flatten all positions at end of backtest" behavior.

              Since those positions exits do not follow the logic of my strategy, i'd rather not have them.


              Thank you bertrand

              Comment


                #8
                You are welcome Zark.be - I will forward your suggestion to development for future consideration, Thanks!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                86 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                48 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                29 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                32 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                67 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X