Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Submitting orders when connection lost

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

    Submitting orders when connection lost

    I have a very important problem to solve.
    Thanks god I was trading the simulator today.
    I lost connection 4 times with IB Server today.

    In one trade I lost 500$ (on the simulator !) because I was working a buy order when I lost connection. When I reconnected I was down 500$ while my stops are set to 100$.
    It could have been worst !

    Here is the problem I am facing.
    I am using the Unmanaged order strategy and my system always buys and sells on stop. I cannot send the stop order before I have my fill on my entry so I am using the OnExecution method to send the stop once I get my fill.
    If I lose connection before my entry is triggered I run the risk of being filled while out of connection with no stop working at all !

    Is there a way I could avoid that BIG problem in my code !

    Thank you very much for your help.

    #2
    Hello blar58,
    Thanks for your post.

    You have to submit a protective stop order while submitting the entry order itself in such scenario and make sure the stop is not simulated in NinjaTrader (i.e. OrderState should be accepted or working).

    You can Change the order later once your entry order gets filled. If you are disconnected, you may not be able to change it but still your protective stop is already residing at the brokers end so that way you are still safe.

    You will not be able to test it in Sim101 account, however I would suggest to test it in the IB paper account.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply JoyDeep

      Maybe I am not understand exactly what you mean but How can I do that with the UnManaged orders strategy ?

      If I send both a buy stop order and a sell stop order and I lose connection -- if market goes down my protective stop will give me a short position when my system is in buying mode. No ?

      Thanks
      Last edited by blar58; 10-05-2012, 12:35 PM.

      Comment


        #4
        Hello blar58,
        You can please a entry order (it can be limit or market order) and a stop order simultaneously.

        Code:
        if (entry condition)
        {
        //buyOrder and stopOrder are both IOrder objects
        buyOrder = SubmitOrder(0,OrderAction.Buy, OrderType.Limit, 1, Close[0] - 8 * TickSize, 0, "", "BuyMkt");
        stopOrder = SubmitOrder(0,OrderAction.Sell,OrderType.Stop, 1 , 0, Close[0] - 15 * TickSize,"OCO","Buy Stop");
        
        }
        You can change the stop order later as per your desire.using the ChangeOrder function.



        The buy order (entry order) will get filled first, and then your stop order in case the downslide continues and your stop gets triggered.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Yes that would not be a problem if my entry order was a limit order but it is a STOP order.

          Is there a way to send an order that will be accepted buy executed only if another order is triggered .
          Last edited by blar58; 10-05-2012, 01:00 PM.

          Comment


            #6
            Hello blar58,
            My apologies. Yes, then that would not work and unfortunately your order will remain exposed to the risks.

            In such scenario we can only advise to run NinjaTrader over a VPS which can minimize connection loss.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            661 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            375 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
            579 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X