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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      662 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      376 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X