Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on session close didn't work

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

    Exit on session close didn't work

    Hi, all

    I have a strategy which is running on MES, 5m chart.

    1. Strategy entered correctly as I expected
    2. Strategy didn't close on session close, however: I do have such setting, and even more in the code I have exitlong/exitshort orders for 15.10 Chicago time, and it shows in log, that it started, but was not successful

    Any recommendations how to solve it? In backtest strategy ended at Exit on session close.

    ​​Click image for larger version

Name:	image.png
Views:	426
Size:	380.6 KB
ID:	1283130

    #2
    Hello mrboltuae,

    From the log it appears that a cancel all orders happened at the same time as the exit was submitted which cancelled the exit on session close order.

    When using NinjaScript it is best to only use one of the available options to exit, if you have logic in your script to exit at a specific time then you would not use exit on session close in that use case but instead use your logic to exit the position.

    Comment


      #3
      Ah, ok, I was thinking to be more safe if I implement extra. Thanks! What do you think is more reliable: exit on close setting or implement it in a code?

      Comment


        #4
        Hello mrboltuae,

        Using time conditions in your code is generally more reliable/robust and can also be backtested. We usually suggest using two sets of time conditions in a strategy, one for the window of time where entries should be allowed to happen and then another after that window to exit and make sure the strategy is flat. The exit on session close feature won't prevent entry logic from happening after the defined seconds and is also a realtime property so it behaves differently in historical tests.

        Comment


          #5
          Thanks! Much appreciated!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          51 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          127 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X