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

Strange exit order

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

    Strange exit order

    I just got a strange exit order in my strategy and I'm trying to figure out why it would exit like this. Please look at the enclosed image which should explain what's happening.

    FYI - the actual exit order in the trace log was this:

    4/23/2013 12:59:59 PM Entered internal PlaceOrder() method at 4/23/2013 12:59:59 PM: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Exit Short Position' FromEntrySignal='Short Position'

    Here's the code that triggered it.

    exitOrder = ExitShort(0, DefaultQuantity, "Exit Short Position", SHORT_POSITION);

    As far as I can see it's a plain old market order.

    My log code is doing this:

    buffer.Append("EXIT REMINDER: ").Append(order.OrderAction).Append(" at ").Append(order.AvgFillPrice).Append(" and clear all stops").Append(".\n");

    So as you can see it was logging the order.AvgFillPrice. Here's the actual output:

    EXIT REMINDER: BuyToCover at 1.05294 and clear all stops.

    FYI - and not obvious from the screenshot - the previous candle's high was 1.0528'4 - exactly one tick lower. I don't recall setting the exit to one tick above the high. And the exitOrder code above that triggered it is obviously a market order.

    So I'm confused - anyone any idea as to what may be happening?

    Thanks!

    Molecool
    Attached Files

    #2
    Originally posted by molecool View Post
    I just got a strange exit order in my strategy and I'm trying to figure out why it would exit like this. Please look at the enclosed image which should explain what's happening.

    FYI - the actual exit order in the trace log was this:

    4/23/2013 12:59:59 PM Entered internal PlaceOrder() method at 4/23/2013 12:59:59 PM: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Exit Short Position' FromEntrySignal='Short Position'

    Here's the code that triggered it.

    exitOrder = ExitShort(0, DefaultQuantity, "Exit Short Position", SHORT_POSITION);

    As far as I can see it's a plain old market order.

    My log code is doing this:

    buffer.Append("EXIT REMINDER: ").Append(order.OrderAction).Append(" at ").Append(order.AvgFillPrice).Append(" and clear all stops").Append(".\n");

    So as you can see it was logging the order.AvgFillPrice. Here's the actual output:

    EXIT REMINDER: BuyToCover at 1.05294 and clear all stops.

    FYI - and not obvious from the screenshot - the previous candle's high was 1.0528'4 - exactly one tick lower. I don't recall setting the exit to one tick above the high. And the exitOrder code above that triggered it is obviously a market order.

    So I'm confused - anyone any idea as to what may be happening?

    Thanks!

    Molecool
    The Market Order gods strike again? One never knows where one will get filled with a Market Order.

    Comment


      #3
      Hello molecool,

      Thank you for your post.

      Market Orders will fill at the next available price, if you wish to determine where the exit will be placed you can use ExitShortLimit(), ExitShortStop() or ExitShortStopLimit().

      You can view the ExitShortLimit(), ExitShortStop() and ExitShortStopLimit() methods at the following link: http://www.ninjatrader.com/support/h...d_approach.htm

      Please let me know if I may be of further assistance.

      Comment


        #4
        Originally posted by koganam View Post
        The Market Order gods strike again? One never knows where one will get filled with a Market Order.
        Well, I was watching it and the candle was opening just then - immediately the exit was being pinned where you see it on the chart. So this confused the heck out of me.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello molecool,

          Thank you for your post.

          Market Orders will fill at the next available price, if you wish to determine where the exit will be placed you can use ExitShortLimit(), ExitShortStop() or ExitShortStopLimit().

          You can view the ExitShortLimit(), ExitShortStop() and ExitShortStopLimit() methods at the following link: http://www.ninjatrader.com/support/h...d_approach.htm

          Please let me know if I may be of further assistance.
          Appreciate the response but I'm not a beginner so I do know about the Limit and Stop exits. I think I described the problem clearly and based on where the price was when I exited it should have been much closer to the current candle's open.

          Comment


            #6
            Hello molecool,

            Thank you for your response.

            What is the time and price listed as for the exit on your Executions tab in the NinjaTrader Control Center?

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello molecool,

              Thank you for your response.

              What is the time and price listed as for the exit on your Executions tab in the NinjaTrader Control Center?
              Here you go: $AUDCAD Buy 1 1.05294 4/23/2013 1:00:00 PM 697d400dfd934a2fbb8cd1d4aea759d8 Exit - da426ddb2e604953bbb7069bd06fea6d Exit Short Position 0 0.974459418637511 Sim101 Yahoo

              Here's the code that triggers the exit with some preceding context:

              Code:
              if (Close[1] > priceTarget) {
              	if (enableLog) {
              	Print(Time[0]);
              	Print("Price ought to be at or below: " + priceTarget + " but prior candle closed at " + Close[1]);
              	Print("Insufficient profit - exiting position.");
              										}
              	exitOrder = ExitShort(0, DefaultQuantity, "Exit Short Position", SHORT_POSITION);
              }
              And here's the resulting log:

              Price ought to be at or below: 1.04972 but prior candle closed at 1.05264
              Insufficient profit - exiting position.
              4/23/2013 12:59:59 PM Entered internal PlaceOrder() method at 4/23/2013 12:59:59 PM: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Exit Short Position' FromEntrySignal='Short Position'
              So there's nothing about closing one tick above the previous high in there. I have no idea how it would slip in. Now fortunately I had TraceOrders set to true - thus the actual executions and order details have been logged. And as you can see from my previous comments there's nothing in there about a Limit Or Stop exit.

              Any help would be appreciated - this doesn't make much sense.
              Last edited by molecool; 04-23-2013, 03:42 PM.

              Comment


                #8
                Anyone?

                Any help would be appreciated - I'm a bit stuck on this one

                Comment


                  #9
                  Hello molecool,

                  Thank you for your response.

                  How is the 'priceTarget' variable set? i.e. What would have been it's value when this occurred?

                  I look forward to your response.

                  Comment


                    #10
                    Originally posted by NinjaTrader_PatrickH View Post
                    Hello molecool,

                    Thank you for your response.

                    How is the 'priceTarget' variable set? i.e. What would have been it's value when this occurred?

                    I look forward to your response.
                    The price target really is unrelated to the exit code Patrick - it's a proprietary algo that measures momentum and then either decides to continue a position or exit it. But it does not affect the actual exit code - which is at market.

                    So far I have not seen any thoughts that would highlight why NT7 is exiting the way it is. I have provided a lot of details here - please see comment #7 further below - all the context is there. My actual calls and the resulting traces have been provided and I would very much appreciate if we could talk about why NinjaTrader exited quite a few pips higher than the market at that moment when a simple ExitShort() call was made.

                    Many thanks,

                    Molecool
                    Last edited by molecool; 04-24-2013, 10:29 AM.

                    Comment


                      #11
                      Just did it again

                      Here's a current example on the CAD/CHF:



                      Here's the actual order:

                      4/24/2013 2:00:02 PM Entered internal PlaceOrder() method at 4/24/2013 2:00:02 PM: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Exit Short Position' FromEntrySignal='Short Position'

                      Comment


                        #12
                        Hello,

                        Thank you for that information.

                        Please right click in your charts in question > select Data Series > under the 'Period' section what is the 'Price Based On' set to?

                        In addition, concerning the AUDCAD market order, does the historical data you have in NinjaTrader show that at 1:00:00 PM on April 23, 2013 the AUDCAD reached 1.05294?
                        You can check this by going to Tools > Historical Data Manager > Edit > select the AUDCAD > Last > Tick.

                        I look forward to your response.

                        Comment


                          #13
                          Originally posted by NinjaTrader_PatrickH View Post
                          Hello,

                          Thank you for that information.

                          Please right click in your charts in question > select Data Series > under the 'Period' section what is the 'Price Based On' set to?

                          In addition, concerning the AUDCAD market order, does the historical data you have in NinjaTrader show that at 1:00:00 PM on April 23, 2013 the AUDCAD reached 1.05294?
                          You can check this by going to Tools > Historical Data Manager > Edit > select the AUDCAD > Last > Tick.

                          I look forward to your response.
                          Price is based on LAST: http://screencast.com/t/jdyjjofPD

                          Under AUD/CAD I'm not finding what you're asking for - April data seems to be MIA somehow. Here, please take a look:

                          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.

                          Comment


                            #14
                            Hello,

                            Thank you for your response.

                            Please check the historical data under Minute and advise if the AUDCAD reached 1.05294 at 1:00:00 PM on April 23, 2013.

                            I look forward to your response.

                            Comment


                              #15
                              Hello molecool,

                              I wanted to add additional information here.

                              When viewing Forex on the chart you may need to view the Ask or Bid price to see where the fill occurred. With Forex you can have a large spread from the broker so the Last data may not match the execution at fill, but the Ask in this case most likely did at the time of execution based on the data from the broker.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ageeholdings, Today, 07:43 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post ageeholdings  
                              Started by pibrew, Today, 06:37 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post pibrew
                              by pibrew
                               
                              Started by rbeckmann05, Yesterday, 06:48 PM
                              1 response
                              14 views
                              0 likes
                              Last Post bltdavid  
                              Started by llanqui, Today, 03:53 AM
                              0 responses
                              7 views
                              0 likes
                              Last Post llanqui
                              by llanqui
                               
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              12 views
                              0 likes
                              Last Post burtoninlondon  
                              Working...
                              X