Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose Seconds not working

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

    ExitOnClose Seconds not working

    Hi,

    I'm backtesting an intraday strategy and I would like it to flatten all open positions at a specific time. I am trying to do this by running the strategy with ExitOnClose turned on, and ExitOnClose Seconds set to 6300. The trading session ends at 4:15PM CST and I would like to exit all open positions at 2:30PM CST.

    When I backtest however the strategy exits all open positions at 4:15PM. It doesn't seem to matter what value I put for ExitOnClose Seconds, it always exits at 4:15PM. Why is this happening?

    Is there a better way to handle a timed exit?

    #2
    Hello PhillyD,

    Thank you for your post.

    This would be the correct setting for ExitOnClose, ExitOnCloseSeconds and the proper number for 45 minutes.

    What bar type are you testing the strategy on and what value? Example: 1 Minute

    Can you attach a screenshot of the settings used for your backtest?

    Comment


      #3
      Hi Patrick,

      I'm using a 5 minute bar on the ES contract. See attached screenshot for the settings.

      Phil
      Attached Files

      Comment


        #4
        Phil, to clarify : we would expect that since ExitOnCloseSeconds is applicable real-time only, not in backtesting. If you want an earlier exit you could consider coding a custom timecheck for example to the bars time (Time[0]) to decide when to exit timebased.

        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X