Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose = true kills Strategy?

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

    ExitOnClose = true kills Strategy?

    I had ExitOnClose = true in the Initialize() method as I do not want to hold positions overnight. I noticed that when a position was closed by ExitOnClose, the strategy failed to continue running at the next FirstTickOfSession -- I would certainly expect the strategy to start executing orders again in the new session.

    Manually stopping & starting the bot is unreasonable. How can I programmatically kick it back into gear when the next session begins?

    #2
    Hi LostTrader,

    This is not how ExitOnClose works so something else is going on. Try backtesting SampleMaCrossOver with this setting. You'll see it close at end of sessions but continue to place trades.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      OK, I have just seen the same behaviour with the StopLoss - After the system closed the position, no more entries are taken.

      The code is running. What else can prevent orders without telling me anything in the output window?

      When my code closes a position, no problem. Next entry is taken.

      Comment


        #4
        OK found a variable that should have been removed -- that seems to have fixed it !

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        333 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        211 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        196 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        287 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        242 views
        0 likes
        Last Post CarlTrading  
        Working...
        X