Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by agclub, 04-21-2024, 08:57 PM
      5 responses
      32 views
      0 likes
      Last Post agclub
      by agclub
       
      Started by ESHunter, Today, 08:06 PM
      2 responses
      16 views
      0 likes
      Last Post ESHunter  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      19 responses
      150 views
      0 likes
      Last Post ETFVoyageur  
      Started by ETFVoyageur, Yesterday, 10:13 PM
      3 responses
      26 views
      0 likes
      Last Post ETFVoyageur  
      Started by ETFVoyageur, Yesterday, 12:52 AM
      3 responses
      33 views
      0 likes
      Last Post ETFVoyageur  
      Working...
      X