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

why was this order getting ignored

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

    why was this order getting ignored

    i had a trailing stop order that i cancelled. i am now reissuing the cancel order but it keeps getting ignored. why?

    2009-05-11 10:07:57 AM Ignored PlaceOrder() method: Action=Sell OrderType=Stop Quantity=2 LimitPrice=0 StopPrice=8419 SignalName=TRAIL_STOP' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place'

    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


    as you can see from teh screenshot of the control center, this orginal order got cancelled.
    Code:
     
    [SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// look for 1 ATR profit
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((take1ATRProfits) && (currentProfitVariable >= ATRValue))
    {
    CancelOrder(exitOrder);
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].MarketPosition)
    {
     
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]MarketPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Long:
    ExitOrderPosition1 = ExitLong(0,position1Quantity, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"1_ATR_PROFIT_TARGETS"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], entryOrder.FromEntrySignal);
    
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]MarketPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Short:
    
    ExitOrderPosition1 = ExitShort(0,position1Quantity, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"1_ATR_PROFIT_TARGETS"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], entryOrder.FromEntrySignal);
    
     
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    }
     
     
    
    take1ATRProfits = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    
    }
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// set 1 ATR trailing stop.
     
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] currentStop;
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] trailstopVolume = (ExitOrderPosition1 == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ? entryOrder.Filled : entryOrder.Filled - ExitOrderPosition1.Quantity);
    Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"trailstopVolume"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + trailstopVolume + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ExitOrderPosition1 "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ExitOrderPosition1 + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" Position.Quantity "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Quantity);
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (trailstopVolume > 0)
    {
    spread = [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Math[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Abs(GetCurrentAsk() - GetCurrentBid()) ;
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (tradedirection)
    {
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Direction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Long:
    currentStop = highestHigh - ATRValue - spread ;
    Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" highestHigh "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + highestHigh + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ATRValue "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ATRValue + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" spread "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + spread);
    
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((exitOrder == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
    exitOrder = ExitLongStop(0,[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal);
    }
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{ 
    
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((exitOrder.OrderState == [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]OrderState[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Cancelled) || (currentStop != exitOrder.StopPrice) )
    {
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// create the exit stop for first time
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]exitOrder = ExitLongStop(0,[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal);
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitLongStop(entryOrder.Filled, currentStop, SIGNALZLREXIT_TRAIL + trailStopPercent + "%", entryOrder.FromEntrySignal);
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]}
    }
    
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//else if (currentStop != exitOrder.StopPrice)
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//{
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// // fire it as it changes.
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitLongStop(trailstopVolume, currentStop, "TRAIL_STOP", entryOrder.FromEntrySignal);
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//}
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]Direction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Short:
    Print([/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" lowestLow"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + lowestLow + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" ATRValue "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ATRValue + [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" spread "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + spread);
    currentStop = lowestLow + ATRValue + spread ;
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// if ((exitOrder == null) || (currentStop != exitOrder.StopPrice))
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((exitOrder == [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) )
    {
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// create the exit stop for first time
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]exitOrder = ExitShortStop(0, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal);
    }
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((exitOrder.OrderState == [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]OrderState[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Cancelled) ||(currentStop != exitOrder.StopPrice) ){
    exitOrder = ExitShortStop(0, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], trailstopVolume, currentStop, [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"TRAIL_STOP"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],entryOrder.FromEntrySignal);
    }
    
    
    }
    
    [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//else if (currentStop != exitOrder.StopPrice)
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//{
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// // fire it as it changes.
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// exitOrder = ExitShortStop(entryOrder.Filled, lowestLow + MFEProfit * trailStopPercent / 100, SIGNALZLREXIT_TRAIL, entryOrder.FromEntrySignal);
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//}
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]break[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
     
    }
     
    }
     
     
    }
    [/SIZE]

    #2
    Known bug. Once you cancel you cannot resubmit at a later point in time.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      so what is my work around?
      Why dont you keep a list of bugs somewhere that i can refer to. why do i have to keep wasting my time debugging your known bugs.

      Comment


        #4
        Workaround is to not do it. If you know you want to resubmit at a later point in time just keep the order active. Modify it to a price that won't fill and only cancel when you are 100% sure you want the stop gone permanently.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          what happens if i cancel order and then set exitorder=null and reuse the object to send the cancel again.

          Comment


            #6
            Unfortunately won't work.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              what is your priority on fixing this bug.

              Comment


                #8
                junkone,

                As you may imagine this is a very sensitive area of code. We are looking to address it as soon as possible.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  is the cancel prob due to the Iorder signal name that is used. i could easily create a new signalname if needed.

                  Comment


                    #10
                    No, it has nothing to do with IOrders. There is nothing on your end you can do to address this except to not cancel an order you may wish to resubmit at a later point in time.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      does it affect orders that get auto cancelled at the end of the bar because i use liveUntilCancelled=false

                      Comment


                        #12
                        Hello,

                        I will have Josh respond to this on Monday.
                        DenNinjaTrader Customer Service

                        Comment


                          #13
                          Yes, if the order expires from non-resubmission to keep it alive, you will experience the same behavior. The issue is with internal handling of the order and will be addressed in a later version.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            this is a very serious bug then. i would have expected you to get a resolution in terms of hours and not days and weeks.
                            i had originally allowed my subscription to expire so that i can fully automate my strategy and start using NT. Now this is causing me to take a double take on whether i should use NT at all.
                            Makes me wonder that with a serous bug like that, if anyone is using NT for real trading at all.
                            the workaround that you propose is a nasty and unacceptable one. setting price to something out of reach.

                            finally, i am asking this question again.why dont you list all the known bugs so that i know what works in NT and what does not.

                            Comment


                              #15
                              junkone,

                              There are many implications in trying to fix anything related to order management and this requires full testing to the highest degree. I have already provided you a workaround that has no adverse implications so I am closing this case now.

                              There is no concentrated external bug list.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Salahinho99, 05-05-2024, 04:13 AM
                              7 responses
                              55 views
                              0 likes
                              Last Post Salahinho99  
                              Started by knighty6508, 05-10-2024, 01:20 AM
                              4 responses
                              26 views
                              0 likes
                              Last Post knighty6508  
                              Started by OllieFeraher, 05-09-2024, 11:14 AM
                              6 responses
                              19 views
                              0 likes
                              Last Post OllieFeraher  
                              Started by PaulMohn, 05-02-2024, 06:59 PM
                              2 responses
                              44 views
                              0 likes
                              Last Post PaulMohn  
                              Started by ETFVoyageur, Today, 02:10 AM
                              0 responses
                              17 views
                              0 likes
                              Last Post ETFVoyageur  
                              Working...
                              X