Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Command to exit and close everything?

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

    Command to exit and close everything?

    I am using a strategy that used the unmanaged approach to enter orders. Suppose I wish to immediately exit all orders at market and cancel all pending orders (eg stops and targets). Is there a simple command I can use to close/cancel everything? Yes I know that strategies do this automatically when RealtimeErrorHandling is StopCancelClose, but I want to trigger this in specific conditions inside my strategy.

    UPDATE: I found the strategy method CloseStrategy(string). Is this the method that I'm looking for? Will CloseStrategy(null) just close/cancel everything (which is what I want)?
    Last edited by westofpluto; 08-11-2021, 08:05 AM.

    #2
    Hello westofpluto,

    Thank you for the post.

    The command which would do all of that will also disable the strategy, that is the CloseStrategy command:



    The alternative would be to just use the order objects that you are tracking to cancel those orders. Any open positions could then be exited after confirming all targets were cancelled, you would generally do that part in OnOrderUpdate.


    I look forward to being of further assistance.

    Comment


      #3
      Hi jess - yes disabling the strategy is fine, as long as it also closes everything. Like I said, I want to replicate the default behavior of what happens when we get a rejected order, which is to close all open positions, cancel any pending stops and targets. If CloseStrategy does this then that's what I want.

      Comment


        #4
        Hello westofpluto,

        Thank you for the post.

        Yes the method will do what you are asking, there is a sample and more information in the help guide page I had linked. Please ensure to read the help guide notes to make sure that works for your use case, otherwise you just need to manage the orders/position yourself in your logic.

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        66 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        141 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        76 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        47 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        51 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X