Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to cancel ATMs with no ATMStrategyID

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

    How to cancel ATMs with no ATMStrategyID

    I have a strategy that places Buy/Sell Stop orders. The problem I'm having is that if I get disconnected from AMP or if the strategy is otherwise disabled, the orders remain. This would not be a problem, but if I get reconnected or restart the strategy, then it places a second stop order at the same price, so now I have two when I only want one.

    The problem is that I don't know how to cancel (or even check for) the previous stop orders that are out there when the strategy restarts. Since there is no ATMStrategyID or OrderID to check with, I have no way in the strategy code to know if there is already an order at the stop price. Can you tell if there is a way in strategy code to check for pending stop or limit orders at a price?

    Thanks!
    Bryan
    cassb
    NinjaTrader Ecosystem Vendor - Logical Forex

    #2
    Hello Bryan,

    Thank you for your post.

    The Strategy will be unable to identify orders from a previous instance of the strategy. In this case the settings under Tools > Options > Strategies > NinjaScript would assist you here.

    In the NinjaScript tab you will see options for 'On starting real-time strategy'. These two options allow you to wait until the historical position is closed (Wait until flat before executing live) or submit historical orders immediately (Immediately submit live working historical orders).
    There a few combinations of these options and Sync Account Position (option is available in the Strategy menu when enabling your strategy on the Strategies tab or on a chart) that you may wish to consider.
    For information on these settings please visit the following link: http://www.ninjatrader.com/support/h..._positions.htm

    You will also notice the options for 'On Connection Loss' under Tools > Options > Strategies > NinjaScript. These options will dictate how connection loss is handled by NinjaTrader for your strategies.
    For information on the Strategies tab of the Options menu please visit the following link: http://www.ninjatrader.com/support/h...tegies_tab.htm

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

    Comment


      #3
      I thought I had it set up correctly. Can you look at my Options tab and see? I attached a screen shot. Shouldn't this setup be canceling the previous stop order that was placed when it gets disconnected?

      Thanks!
      Attached Files
      cassb
      NinjaTrader Ecosystem Vendor - Logical Forex

      Comment


        #4
        Hello Bryan,

        Thank you for your response.

        The Stop is an exit order, correct? If so, then under Order Handling you would want to select 'Cancel exit orders when a strategy is disabled'.

        This means when the connections is lost and then reconnected but the strategy was disabled the exit orders will be cancelled. This would be desirable if you already managed the position with your broker before connection was re-established.

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

        Comment


          #5
          No, the stop is an entry order. I think it would be not a good idea to cancel exit orders if disconnected. That would leave any open orders unmanaged.
          cassb
          NinjaTrader Ecosystem Vendor - Logical Forex

          Comment


            #6
            Hello Bryan,

            Thank you for your response.

            That would be correct. In this case the settings you provided in your screenshot would be correct.

            Comment


              #7
              OK, so then back to the original question... what can I do within the strategy code to check and see if there is already a pending stop order at the price? If there is one, I will make the strategy NOT put another order there.

              Thanks!
              Bryan
              cassb
              NinjaTrader Ecosystem Vendor - Logical Forex

              Comment


                #8
                Hello Bryan,

                Thank you for your response.

                You would only be able to check the orders of the current instance of the strategy. There is no method to check if there is already a pending order at the price level.

                Comment


                  #9
                  OK, in that case, can we research why the pending orders are not getting canceled by the strategy when it is disabled? Do you want to see my trace and log files from today?
                  cassb
                  NinjaTrader Ecosystem Vendor - Logical Forex

                  Comment


                    #10
                    Hello Bryan,

                    Thank you for your response.

                    So the settings under Tools > Options > Strategies > NinjaScript were already set as displayed in your screenshot and yet the orders were not cancelled when the strategy was disabled due to disconnect?

                    Please send me your log and trace files for today along with the time of the disconnect so that I may look into what occurred.

                    You can do this by going to the Control Center-> Help-> Mail to Support.

                    Please place 'ATTN: Patrick - 935770' in the subject line and reference this thread in the body of the email: http://www.ninjatrader.com/support/f...ad.php?t=61395

                    I look forward to your response.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,604 views
                    0 likes
                    Last Post aligator  
                    Started by jaybedreamin, Today, 05:56 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post jaybedreamin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    18 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    13 views
                    0 likes
                    Last Post Javierw.ok  
                    Working...
                    X