Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exitonclose

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

    exitonclose

    Hi,

    How do I reference exitonclose orders or executions in my code? I'm using Unmanaged orders, and when I exit an order, I want to code to make sure variable x = 0. I can do that with normal exit orders --- using if (exitLong1 = e.Order) under OnExecution(IExecution e) --- but havent figured out a way to call code when the exit is entered internally on close.

    Thanks!

    -Nick

    #2
    Hello,

    Thanks for the note.

    There are quite a few limitations on Exit On Close orders generated by NT in NinjaScript. Therefor I'm going to recommend that you do not use Exit On Close orders. This will simplify your code and give you less chance for hitting limitations.

    Please manually code in the order submission for closing at the Last bar of the session using the following flag to trigger the exit on close, you could also use a time to trigger your own exit on close.



    Then using this sample code if you are not aware to take an action based on time.



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks for the tip, Brett. I'll do that!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X