Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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?
    BertrandNinjaTrader Customer Service

    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
        BertrandNinjaTrader Customer Service

        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 -

            BertrandNinjaTrader Customer Service

            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.
                BertrandNinjaTrader Customer Service

                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.
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DayTradingDEMON, Today, 09:28 AM
                    1 response
                    12 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by cmtjoancolmenero, Yesterday, 03:58 PM
                    8 responses
                    31 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by helpwanted, Today, 03:06 AM
                    2 responses
                    22 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Started by navyguy06, Today, 09:28 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post navyguy06  
                    Started by rjbtrade1, 11-30-2023, 04:38 PM
                    2 responses
                    77 views
                    0 likes
                    Last Post DavidHP
                    by DavidHP
                     
                    Working...
                    X