• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

order cancellation message

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

    order cancellation message

    Hey guys, so I'm trying to figure out whats going on. When the system enters an order it sometimes puts the stops above price for a long although it is set to put stops below swing lows - 3 ticks... Having some trouble deciphering where the issue is.

    The swing stop strength is set to 5 and I noticed that price is in a downtrend and there are not swing lows anywhere near price, could this be the issue?

    chart with no swing lows
    https://gyazo.com/90c17df7bc706f34357c42dc8bb503ba


    error messages

    https://gyazo.com/fade60e9eb2ee41f5db6f45e8e6f54e3

    https://gyazo.com/df150b284c17308f8977eb563870dbfd

    #2
    Hello brucelevy,

    When calculating the price of your stop are you checking that the buy stop is above the ask or that the sell stop is below the bid?

    Do you have prints that show the price that the order is being set to along with the current bid or ask price?
    http://ninjatrader.com/support/helpGuides/nt7/print.htm

    If so, please attach these prints to your next post.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have the output window up now so if anything shows up ill repost; this is what I have for now from the log

      https://gyazo.com/f9af9315907356bcced9314a69e091d1

      Comment


        #4
        Hello brucelevy,

        The Log is showing that an order was cancelled after another order was executed. (It looks like a profit target filled to close a short position and then the associated stop was cancelled)

        However, the Log wouldn't show you which condition is setting the stop loss to an invalid price or what the current ask or bid price is when the stop is placed.

        TraceOrders and prints are going to give you this information.
        TraceOrders - http://ninjatrader.com/support/helpG...raceorders.htm
        Prints - http://ninjatrader.com/support/helpGuides/nt7/print.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I put in the trade but I am getting thousands of these occurrences where it prints exits..

          I have this before any of the exits so I don't know why its printing exits if its not in a position

          if(Position.MarketPosition == MarketPosition.Long

          9/22/2015 12:06:24 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='S2' Reason='This was an exit order but no position exists to exit'
          Exit Short trade at 1125.3 at 9/22/2015 12:06:22 PM

          Comment


            #6
            Hello brucelevy,

            Try printing the position outside of that condition.

            Print(Time[0] + " | " + Position.MarketPosition);
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              9/22/2015 12:41:03 PM Amended stop order: Order='86bdfacafc2d40f6b85de20c02df8e02/Sim101' Name='Stop loss' State=Accepted Instrument='YM 12-15' Action=Sell Limit price=0 Stop price=16151 Quantity=1 Strategy='VolatilityTrader' Type=Stop Tif=Gtc Oco='1b045cef11fc42eaa7eb8555d10f0abd-429' Filled=0 Fill price=0 Token='86bdfacafc2d40f6b85de20c02df8e02' Gtd='12/1/2099 12:00:00 AM'

              9/22/2015 12:41:03 PM Cancelled pending exit order, since associated position is closed: Order='86bdfacafc2d40f6b85de20c02df8e02/Sim101' Name='Stop loss' State=Accepted Instrument='YM 12-15' Action=Sell Limit price=0 Stop price=16151 Quantity=1 Strategy='VolatilityTrader' Type=Stop Tif=Gtc Oco='1b045cef11fc42eaa7eb8555d10f0abd-429' Filled=0 Fill price=0 Token='86bdfacafc2d40f6b85de20c02df8e02' Gtd='12/1/2099 12:00:00 AM'



              Here is a screen shot of the above trade, I don't know why it has exited like that, the exit logic is either 10 ticks then breakeven or the yellow line crossbelow the pink... The swing stops look like they were placed 3 ticks below the swing low at 16151 according to the log which is correct..

              https://gyazo.com/e797f1ecfa573e8515ef63397aa74cef

              Comment


                #8
                Hi brucelevy,

                To assist I will need information.

                What do you want to troubleshoot first?

                Do you want to find out why orders are being rejected?
                Do you want to know why the exit order was cancelled after the entry order trade was closed?

                The exit order that closed the trade on the chart is just named Sell. This means that it was not a stop loss that exited the order.

                Do you call ExitLong, ExitLongLimit, or ExitLongStopLimit anywhere in your code?

                Having added prints to each condition to see what time each condition is being triggered?
                May we see these prints?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I'd like to first find out why the trades are exiting prematurely. Here is the long exit condition set (flip for shorts)

                  // Exit Long Condition
                  if(Position.MarketPosition == MarketPosition.Long
                  && CrossBelow(LinReg(14), KAMA(2, 10, 30), 1))
                  {
                  ExitLong("", "L1");

                  }

                  // Swing Stop

                  if(Position.MarketPosition == MarketPosition.Long)
                  {
                  SetStopLoss(CalculationMode.Price, Swing(5).SwingLow[0] - 3 * TickSize);
                  }

                  //breakeven at 9 ticks then plus 2

                  if (Position.MarketPosition == MarketPosition.Long
                  && Close[0] > Position.AvgPrice + 9 * TickSize)
                  {
                  SetStopLoss(Position.AvgPrice + 2 * TickSize);
                  }
                  //trail on KAMA after x ticks

                  if (Position.MarketPosition == MarketPosition.Long
                  && Close[0] > Position.AvgPrice + 12 * TickSize)
                  {
                  SetStopLoss(CalculationMode.Price, KAMA(2, 10, 30)[0] - 1 * TickSize);
                  }

                  Comment


                    #10
                    Hello brucelevy,

                    Looking at the provided code (I cannot say wether or not the issue is with code that was not included) the following could be exiting your order:
                    Code:
                    if(Position.MarketPosition == MarketPosition.Long 
                    && CrossBelow(LinReg(14), KAMA(2, 10, 30), 1))
                    {
                    ExitLong("", "L1");
                    }
                    Try a print to see if this is the order causing the exit.

                    Code:
                    if(Position.MarketPosition == MarketPosition.Long 
                    && CrossBelow(LinReg(14), KAMA(2, 10, 30), 1))
                    {
                    Print(Time[0]+" | exiting order")
                    ExitLong("", "L1");
                    }
                    Do you see this print appear at the time the order is closed?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      It just says exiting order continuously..


                      9/25/2015 10:52:40 AM | exiting order L2
                      9/25/2015 10:52:40 AM | exiting order L3
                      9/25/2015 10:52:40 AM | exiting order L4
                      9/25/2015 10:52:40 AM | exiting order S2
                      9/25/2015 10:52:40 AM | exiting order S4
                      9/25/2015 10:52:40 AM | exiting order S5
                      9/25/2015 10:53:07 AM | exiting order L2
                      9/25/2015 10:53:07 AM | exiting order L3
                      9/25/2015 10:53:07 AM | exiting order L4
                      9/25/2015 10:53:07 AM | exiting order S2
                      9/25/2015 10:53:07 AM | exiting order S4
                      9/25/2015 10:53:07 AM | exiting order S5
                      9/25/2015 10:53:17 AM | exiting order L2
                      9/25/2015 10:53:17 AM | exiting order L3
                      9/25/2015 10:53:17 AM | exiting order L4
                      9/25/2015 10:53:17 AM | exiting order S2
                      9/25/2015 10:53:17 AM | exiting order S4
                      9/25/2015 10:53:17 AM | exiting order S5

                      Comment


                        #12
                        Can you look over the script if I send it to you?

                        Comment


                          #13
                          Is this correct where it says if market position is short AND Ling Reg cross above KAMA exit short?
                          It should exit the short position if the linreg crosses above the kama...

                          if (Position.MarketPosition == MarketPosition.Short
                          && CrossAbove(LinReg(14), KAMA(2, 10, 30), 1))
                          {
                          ExitShort("", "S1");
                          Print(Time[0]+" | exiting order S1");


                          }

                          Comment


                            #14
                            Here is what I have for an ES long position that went off and immediately closed out at breakeven
                            Output window:

                            9/25/2015 11:15:00 AMLong Entry L2Flat
                            9/25/2015 11:15:00 AM | exiting order L2

                            Log:

                            https://i.gyazo.com/666757ce010451ef...e946dcbf59.png

                            Executions page:

                            https://gyazo.com/c6be94cd853061e0d40eaa4ad8e3b01d
                            Last edited by brucelevy; 09-25-2015, 09:20 AM.

                            Comment


                              #15
                              It tried to go short and said I cant put a buy stop limit below the market... I dont know why its trying to put stop losses below the sell when the code doesnt say to do that..

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cirzonorkecv, Yesterday, 11:52 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post cirzonorkecv  
                              Started by rickyblah12, Yesterday, 01:01 PM
                              1 response
                              12 views
                              0 likes
                              Last Post Erwin Beckers  
                              Started by dadarara, Yesterday, 12:18 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post dadarara  
                              Started by joemiller, Yesterday, 07:33 AM
                              2 responses
                              12 views
                              0 likes
                              Last Post joemiller  
                              Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
                              7 responses
                              38 views
                              0 likes
                              Last Post DaveS
                              by DaveS
                               
                              Working...
                              X