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

Order Reversal causes IB to recognize 2xtimes the order quantity and to terminate NT

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

    Order Reversal causes IB to recognize 2xtimes the order quantity and to terminate NT

    Hi,
    there is a problem between NT and IB which is caused by the reversal of a position.

    IB recognizes 2x times the quantity, which is actually the closing and the reverse opening. After long talks with NT and IB support, both ends seem to point out a different reason for this.

    IB support say that they get 3 orders, which NT support say that the problem is in the 2 orders + the profit loss and stop loss orders which go to "pending cancel" mode.

    Has anyone else had this problem?

    This is a major concern, as NT terminates all the time and I am unable to effectively trade with my Margin allocation.

    Anyway, at this point it seems the only way to solve this is to add a 1 sec speed bump between the order for the closing of the positing and the one that follow for the reversal.

    Does anyone have any idea on how I can add such a speed bump?

    Any input will be very much appreciated.

    #2
    Hi nikolaalx,

    Are you trying to exit a position and reverse a position on the same bar (is EnterLong or EnterShort called on the same bar as ExitLong or ExitShort or when a StopLoss or ProfitTraget has filled)?

    If so, this will send three orders. The first order is to close your position so you will be flat. The second order will be to close your position coming from the reversal this will take the opposite position with a quantity of 1. Then there will be a 3rd order to enter the new position (which was already entered by the second exit attempt) which will cause you to be double in the reverse position.

    If you are reversing position, you cannot have any kind of exit order fill on the same bar or this will double your position in the reverse.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have a very simple strategy that is based on Aroon crossover.

      When Aroon up crosses Aroon down, go long.

      When Aroon down crosses Aroon up, go short.

      Simple as that. The strategy is built via the wizard. As a logic it does not differ in any way from MACrossover.

      It is characterized with a lot of reversed entries (and rarely any profit taker/stops being hit).

      With this being said I have not done any trigger that would try to close the position before it is being reversed.

      Not sure if this answers your question, but I guess this comes down to how exactly NT handles reverses...and why IB recognizes three orders when I am reversing an order.

      Here is the exact response that IB support gave me :

      Below are all the orders that we received and the modifications that we were forced to make to your FB orders, as a result of your market orders receiving an execution

      (1) 14:58:31.872 EST: Order to SELL 3102 shares of FB at a STOP price of 63.87 (Part of an OCA group)
      (2) 14:58:32.007 EST: Order to SELL 3102 shares of FB at a limit price of 66.51 (Part of the same OCA group as number 1)

      (3) 14:58:32.183 EST: Order to BUY 3102 shares of FB at the market, which received an execution at 14:58:32.211 EST... After the execution you were now long 3102 shares of FB

      Order (2) was originally marked as a short sale
      At 14:58:32.265 EST (After the execution to BUY of 3102 shares) Order 2 was modified, as it was no longer a short sale and marked as a closing order

      (4) 15:09:57.103 EST: We received an order to SELL 3102 shares of FB as the market, which received an execution at 15:09:57.130 EST... After the execution of this order you were flat

      Order (2) which was original marked as a short sale, and then changed to closing order
      AT 15:09:57.155 EST (After the execution to SELL 3102 shares) Order 2 was modified again from a closing transaction back to a short sale

      (5) 15:09:57.336 EST: We received an order to short 3096 shares of FB at the market, which received an execution at 15:09:57.392 EST. After the execution of this order you were now short 3096 shares of FB

      At 15:09:57.518 EST: Order (2) was canceled by user nikola922, as a result order (1) was canceled, as they were the part of the same OCA group

      (6) 15:09:57.336 EST: We received an order to SELL an additional 3102 shares of FB at the market. However, the order was rejected because this trading account did not have enough margin to hold short 6,198 shares of FB




      Originally posted by NinjaTrader_ChelseaB View Post
      Hi nikolaalx,

      Are you trying to exit a position and reverse a position on the same bar (is EnterLong or EnterShort called on the same bar as ExitLong or ExitShort or when a StopLoss or ProfitTraget has filled)?

      If so, this will send three orders. The first order is to close your position so you will be flat. The second order will be to close your position coming from the reversal this will take the opposite position with a quantity of 1. Then there will be a 3rd order to enter the new position (which was already entered by the second exit attempt) which will cause you to be double in the reverse position.

      If you are reversing position, you cannot have any kind of exit order fill on the same bar or this will double your position in the reverse.
      Last edited by nikolaalx; 06-25-2014, 02:10 PM.

      Comment


        #4
        Hi nikolaalx,

        Just to confirm, you do not have a stop loss or profit target in your script, is this correct?

        If there are no exits and no profit targets and no stop losses... then I would like to test this on my end.

        Please let me know if this is the case and I will have you email in so that we can work on this together.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I do have stop loss and profit taker, but they rarely get hit. I am saying this just to elaborate that the majority of the entries are being reversed (entry -> new entry)..and not entry-> stop loss/profit taker -> new entry.

          Comment


            #6
            if (CrossAbove(Aroon(AroonPeriod).Up, Aroon(AroonPeriod).Down, 1)
            && ToTime(Time[0]) >= ToTime(StartHours, StartMinutes, 0)
            && ToTime(Time[0]) < ToTime(EndHours, EndMinutes, 0)
            && Aroon(AroonPeriod).Up[0] > ARSwitch))
            {
            EnterLong(DefaultQuantity, "");
            Variable0 = 0;
            Variable1 = 1;
            }

            if (CrossAbove(Aroon(AroonPeriod).Down, Aroon(AroonPeriod).Up, 1)
            && ToTime(Time[0]) >= ToTime(StartHours, StartMinutes, 0)
            && ToTime(Time[0]) < ToTime(EndHours, EndMinutes, 0)
            && Aroon(AroonPeriod).Up[0] > ARSwitch))
            {
            EnterShort(DefaultQuantity, "");
            Variable0 = 0;
            Variable1 = 1;
            }


            I realize I have also 2 signals that close a position. They are not with "else if" but as a independent conditions. The basically check if Aroon falls under a specific numeric value (40) in the current case). I realize that when a reverse entry is made, in most occasions, the opposite Aroon falls at the same time below that specific exit value. Is it possible for both conditions to execute and send simultaneously a Reverse and a close positio entry? How would NT handle this and could this be the reason?


            if (CrossBelow(Aroon(AroonPeriod).Up, ExitValue, 1))
            {
            ExitLong("", "");
            }


            if (CrossBelow(Aroon(AroonPeriod).Down, ExitValue, 1))
            {
            ExitShort("", "");
            }


            Should I add those under each entry/reverse condition with a "else if" so that they would be triggered only in the event that the main condition has not been triggered?

            Comment


              #7
              nikolaalx,

              Give all of the exits a signal name.

              This will tell you if one of the orders is the exit order.

              I still think the situation is as I described in post #2
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ezrollin, Yesterday, 11:26 PM
              1 response
              38 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by ezrollin, Yesterday, 09:10 PM
              1 response
              51 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by traderhawk, Today, 05:53 AM
              0 responses
              10 views
              0 likes
              Last Post traderhawk  
              Started by Angus7, Today, 04:31 AM
              8 responses
              49 views
              0 likes
              Last Post Angus7
              by Angus7
               
              Started by aligator, Yesterday, 11:24 PM
              0 responses
              43 views
              0 likes
              Last Post aligator  
              Working...
              X