Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy exit question

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

    Strategy exit question

    Please pardon my newbyness for such a basic question. I'm very new to coding and I have no plans to immerse myself into it since I am newly retired. So, with the help of Youtube University, I have created a few automatic trading strategies in strategy builder that seem to back test pretty well. However, sometimes I notice there is a better time to exit my trades than the program is set to exit so click on the good ol' "Close" button which of course closes out my position but my programmed exit still remains in play. The only way I can find to delete the remaining exit is to disable the strategy and then delete the programs exit, then re-enable the strategy again. Is there an easier way to exit and be done with the strategy when I feel it's ran it's course?

    #2
    Hello ARobotPolisher,

    Welcome to the NinjaTrader forums!

    Below is a link to a support article with helpful resources on getting started with NinjaScript and C# development.


    Manually clicking the Close button will disable any NinjaScript Strategy with an open position on the same instrument to prevent the strategy position from becoming out of sync with the account position.
    Any manually submitted orders are not seen by the strategy. If the strategy and account are both long 1, and the account has a manual order to sell 1, the account becomes flat while the strategy still has a long position. The strategy may place an order to exit the long position which would make the strategy flat and the account short 1 (and unprotected).

    I would recommend instead adding a button to the chart from the strategy so that when you click the button the strategy can place the exit order which would affect the strategy position and account position keeping them in sync and would not disable the strategy. This would require unlocking the script and coding by hand.

    Below is a link to an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks. Those were the correct conditions on the image I first sent over. The conditions were set to "Any" by default and I just revised that to "All". I feel like an idiot. The buy and sell triggers are working exactly like I want them to now. The results are absolutely miserable but I can see at least it works as programmed.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X