Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Remove multiple orders / unmanaged approach

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

    Remove multiple orders / unmanaged approach

    Hello,

    I have multiple stop orders in the order tab. These were submitted by a strategy with an unmanaged approach.

    Is it possible somehow that I cancel the stop orders that are related to a specific symbol e. g. 5 orders out of 6 orders using a loop?

    Kind regards
    Gerik




    #2
    Hello Gerik,

    Are you asking how to do this as a regular action that your script would need to take or are the orders currently stuck/needing manually managed?

    Managing orders from outside the strategy will in some cases disable the strategy in case the position is closed. If this is something the strategy should regularly have happen then the best way would be to add a custom button or condition to trigger that action from the strategy its self. The strategy would have the full details on those orders already and by managing the position its self it can stay enabled. If you otherwise infrequently need to do this, don't mind the strategy being disabled an addon could be used to loop over an accounts order collection.

    Could you provide a bit more detail on the overall goal so that I can point out the correct info for the use case?

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      thank you for your mail. A custom button I have already implemented. In the next step, I would like my script to double-check as a regular action whether there are already sell stop limit orders generated by the strategy.

      I have experienced situations where e.g. more than one stop order is visible. If that is the case I would like to cancel the remaining orders and just change the limit of one remaining stop limit order using ChangeOrder(). The objective would be to avoid that more orders are executed than initially intented, because there are just some residual orders.

      How can I loop over an accounts order collection and fetch, check and delete the stop orders?

      Kind regards
      Gerik

      Comment


        #4
        Hello Gerik,

        I would like my script to double-check as a regular action whether there are already sell stop limit orders generated by the strategy.

        With the managed or unmanaged approach you would need to track the orders you submit on your own using the OnOrderUpdate or OnExecutionUpdate events. By storing the orders as variables you can later cancel or change them when needed.

        There is a simple example of storing orders and calcelling them in the following post, the same concept would apply in your situation. You would store each unique order to its own variable and later use that variable to manage that order.


        By doing individual variables you don't need to worry about loops or collections. You can certainly make the code more complex and use a List<Order> if you wanted to store the observed orders to a collection for accessing them later.



        I look forward to being of further assistance.

        Comment


          #5
          Hello Jesse,

          thank you for your message.

          I am tracking the orders already with the unmanaged approach using individual variables with the given sample script.

          However, there are situations when there is more than one stop order in the orderbook although having only one variable trailingStopLong.

          Is it somehow possible to look for any residual stop limit orders? I would guess if there are e.g. two stop limit orders that came from the strategy having the same name, it should be possible to fetch them again somehow.

          Sincerely
          Gerik

          Comment


            #6
            Hello Gerik,

            If you have the variables for the orders you could add a condition to check if each order is still working or filled. Instead of looping you would just have 4 conditions if you have 4 orders as an example.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            127 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X