Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with automated close of market order

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

    Problem with automated close of market order

    Hi,

    I have a script that automatically closes market orders at 3:58pm. It has seemed to work ok, but today on a large position it only closed part of the order at 3:58.

    At 3:58, it sold about 2/3rds of the position. I was watching and noticed the entire position didnt close. I then checked my live orders in MBTrading and found it to be empty. At that point, I manually closed the remainder of the position.

    A few seconds later, i noticed that i now had a new live short position in the security! I went ahead and manually closed this also.

    When i went back and checked in the NT logs, it appears it generated an order to close part of the position at 3:58. At 3:59, it generated an order to close the remainder of the position. Because i had already manually closed the remainder of the position, it ended up opening a new position.

    My question is, why would it have only closed part of the position on the 58th minute? It is a single entry signal and a simple exitlong command i send?

    Thanks for your help!

    #2
    Hi bridenour, it looks like you got only a partial fill on that exit order - please send me your trace and logs to support at ninjatrader dot com (Attn Bertrand) to investigate. Thanks!
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi,

      I have been running my live strategy for several days now, and it is frequently not closing open positions properly. All positions are opened with market orders and attempted to close with market orders.

      For example, today at 1:34 is opened a position in an instrument for 1175 shares, and at 1:43 a stop was triggered, and a market sell order executed. However, it only generated a market sell order for exactly 200 shares. The remaining position is left open and completely unmanaged.

      My strategy is rather complex and is multi-instrument. I do not use different enter signals for each instrument, as I am assuming the signals are contained within the context of each bar/instrument being processed.

      Can you please advise what the potential causes of this could be? It is not a partial fill problem, as the quantity ninja trader is attempting to close is simply incorrect.

      Thanks!

      Comment


        #4
        Hi bridenour, hard to say without the strategy code - if you like you can forward this to support at ninjatrader dot com and I will have a look. I would recommend you use different entry / exit signals to reference the correct position - maybe this is of help - http://www.ninjatrader-support2.com/...ead.php?t=3225
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand -

          Do I need to use a different entry and exit signal for each instrument in my strategy? I was assuming it was only necessary if i were making multiple trades of a single instrument.

          I only have at max 1 open trade for each instrument, but i may have several different instruments open at a time. Does each insturment need its own individual entry signal?

          The example you reference is only for a single instrument.

          Thanks

          Comment


            #6
            Hi bridenour, yes please use a unique entry name for a different entry and test the strategy again.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I have changed my multiinstrument strategy to use a unique signal for each instrument in the strategy. It will execute starting today -- I am hoping it actually begins to close positions correctly.

              Thanks

              Comment


                #8
                Ok great please let us know.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Unfortunately, even though i have now included distinct signals with each instrument position open, it is still only closing partial positions. When it opens the position, the order seems to be filled in chunks, and for some reason, when it decides to close the position, it only issues a close order for part of the total quantity that was opened.

                  I am going to send over my log that demonstrates this...

                  Comment


                    #10
                    Thanks for the update - please send the logs to support at ninjatrader dot com Attn Bertrand.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Ok i sent the log file....let me know if you will also need the trace.

                      thanks

                      Comment


                        #12
                        Thanks responded via mail, you will need to debug why your 'sell long' signal generates an order for 400 shares only.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          I see. So, this problem never occurs in backtesting.

                          My exits are just a simple "Exitlong" with the original signal name. I don't even specify any amounts on the exit.

                          Im at a loss as to where to even start in terms of debugging this. How could anything i do influence the amount of shares the system decides to close, given the exit approach i am using? I assumed NT tracked internally the size of the position it originally opened, and then closed the correct size/amount based on using the original entry signal to close the position.

                          I'm very glad to debug this, but need some help/direction as to where to focus.

                          thanks

                          Comment


                            #14
                            I would be glad to track my initial position size that i open, and then specify it explicitly when i issue the close, if that would work around this. Let me know if that would be a superior approach.

                            Comment


                              #15
                              Isn't the original size specified by pSize in the code you send me? Then try using this also in your Exit orders.
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by r68cervera, Today, 05:29 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post r68cervera  
                              Started by geddyisodin, Today, 05:20 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post geddyisodin  
                              Started by JonesJoker, 04-22-2024, 12:23 PM
                              6 responses
                              35 views
                              0 likes
                              Last Post JonesJoker  
                              Started by GussJ, 03-04-2020, 03:11 PM
                              12 responses
                              3,239 views
                              0 likes
                              Last Post Leafcutter  
                              Started by AveryFlynn, Today, 04:57 AM
                              0 responses
                              7 views
                              0 likes
                              Last Post AveryFlynn  
                              Working...
                              X