Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Place order, lose connection

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

    Place order, lose connection

    I have a SetStopLoss statement in my Initialize event. Suppose my strategy places an order and I lose my connection - is a stop limit order on with my broker? What are my options in this situation?

    Thank you

    #2
    Hi Scott, welcome to our forums - that would be a StopMarket order which would be rested at your broker's server or the exchange depending on the provider used. Are you using a profit target order here as well in this case?

    Comment


      #3
      Thanks, Bertrand. Yes I use a SetProfitTarget statement as well:

      Code:
      	SetProfitTarget(sENTRY1L, CalculationMode.Ticks, ProfitTarget);
      	SetProfitTarget(sENTRY1S, CalculationMode.Ticks, ProfitTarget);
      	SetStopLoss(CalculationMode.Ticks, StopLoss);
      Are you saying the SetStopLoss order will place a market order as opposed to a limit order?
      Also, is there a way I can verify this through a trace or log file?

      Thank you.

      Comment


        #4
        That's correct , you can check the orders tab in the Control Center to verify what orders and types are placed.

        Since you enter a stop / target order both would be linked via OCO logic, here the connection technology used determines if the OCO order management is done locally or natively at the broker's server :

        Note: This information is relevant for NinjaTrader 7 only. For NinjaTrader 8, please click here (https://ninjatrader.com/support/helpGuides/nt8/where_do_your_orders_reside_.htm). CQG Orders in a state "Accepted" or "Working" are at the exchange. If the exchange does not support a specific order type, the

        Comment


          #5
          Thanks again, Bertrand. I happen to be using the CQG data provider.

          Also, I came across the OnConnectionStatus event and was wondering how I might use this upon losing a connection. Is it worthwhile? Could you point me somewhere which codes this event in a useful way?

          Comment


            #6
            You're welcome, for CQG the management is local and this would mean NT has to be connected live in order to manage it for you (for example cancel the stop if target reports filled).

            OnConnectionStatus() is useful for monitoring your connection state, for example if only the price connection goes down and you're not reconnected within x seconds you could attempt to close positions still within the strategy (provided the order connection is still running).

            Another important setting is the ConnectionLoss Handling described here -

            Comment


              #7
              Bertrand,

              I want to make sure I understand the process so please bear with me -

              My data provider is CQG with AMP Futures. I am using SetProfitTarget and SetStopLoss in my strategy. Once an order is placed and filled via my strategy, two limit orders are virtually simultaneously placed, one for profit and one for stop. Then say I lose my connection before the target or stop orders are hit. If I understand, the two limit orders rest with my broker AMP, so despite my losing a connection, my orders are "safe" in that they are in the hands of the broker. Am I understanding this correctly?
              Having said that, are you saying this may not be the case if my data provider and/or broker are different?

              Please pardon my repetitiveness.

              Thank you

              Comment


                #8
                The orders would going into 'accepted' (the stop) and 'working' state (the target) - what is not possible for NT then if you're losing connection is canceling the unneeded order if one part of your bracket fills while you're offline. So in turn the other still resting order could execute as well in this scenario if you do not reconnect in time to cancel it.

                Comment


                  #9
                  Thanks, Bertrand, I'm getting the picture. Just a follow up then-- you say that:

                  what is not possible for NT then if you're losing connection is canceling the unneeded order if one part of your bracket fills while you're offline. So in turn the other still resting order could execute as well in this scenario if you do not reconnect in time to cancel it.
                  Assuming the unneeded order has not been filled yet, then when the connection is re-established, would the unneeded order be automatically disposed of properly?

                  Comment


                    #10
                    Yes, as NT would see that the other part of the OCO / OCA group has been filled, this would lead to cancellation of the other outstanding order.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    662 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    376 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    110 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    574 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    580 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X