Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems With Position.Quantity

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

    Problems With Position.Quantity

    It seems as though Position.Quantity has a maximum value for me of 2. I recently made an addition to the strategy with a 3rd potential entry set of conditions. I have all exit conditions set to exit Position.Quantity, but I have 3rd and sometimes 4th entries which do not exit along with the other two when exit conditions are met.

    Each entry condition has its own exclusive exit conditions, and they are linked by names.

    Do I need to create my own position counter? Or what is going on here?

    #2
    Hello liquid150,

    Thank you for your note.

    Would you please post each entry and exit call in your script along with what you have entries per direction and entry handling set to? These would be under State.Set Defaults.

    So I can best answer your question, you are saying that the strategy has 3-4 difference positions however when you try to exit using Position.Quantity, it only closes 2 of 3? Are you certain these extra positions are being taken from the strategy?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello liquid150,

      Thank you for your note.

      Would you please post each entry and exit call in your script along with what you have entries per direction and entry handling set to? These would be under State.Set Defaults.

      So I can best answer your question, you are saying that the strategy has 3-4 difference positions however when you try to exit using Position.Quantity, it only closes 2 of 3? Are you certain these extra positions are being taken from the strategy?

      I look forward to your reply.
      Hi Alan,

      I use your Strategy Builder. Can you please tell me the best way to post the entries and exits?

      I am saying exactly that. There are 3 potential ways the strategy can enter the market long (this problem does not happen on short orders, and there are 2 potential ways the strategy can enter short). All possible exit conditions are set to close with Position.Quantity. However, sometimes the strategy will enter long 3 (or more) times before closing any positions, and when this happens and an exit condition is realized only 2 contracts will be sold and the rest will remain.

      Also, sometimes buy orders are executed simultaneously with Sell to Exit orders, and this results in an "invisible" order which is not subject to stop losses OR exit conditions, and must be closed with an "empty named" exit condition. It's kind of strange...

      Edit: Oh, and I forgot to answer your question. My order handling is set to Unique Entries and I have 2 entries per direction.

      FYI this strategy is being tested on a poor internet connection...
      Last edited by liquid150; 10-17-2017, 10:10 AM.

      Comment


        #4
        Originally posted by NinjaTrader_AlanP View Post
        Hello liquid150,

        Thank you for your note.

        Would you please post each entry and exit call in your script along with what you have entries per direction and entry handling set to? These would be under State.Set Defaults.

        So I can best answer your question, you are saying that the strategy has 3-4 difference positions however when you try to exit using Position.Quantity, it only closes 2 of 3? Are you certain these extra positions are being taken from the strategy?

        I look forward to your reply.
        Oh, and yes, Alan. I am certain they come from the strategy because there is no other strategy running on the instruments in question.

        Comment


          #5
          Hello Liquid150,

          If you have 3 different sets of conditions which enter long and they are all uniquely named, you would need to have entries per direction set to 3 rather than 2, assuming you want to allow each to be executed.



          If you are long 1 and then one of your conditions to EnterShort is called, two orders will be submitted, 1 to flatten you up and 1 to get your short.

          I would suggest not using Position.Quantity in your exit calls and leaving quantity to default quantity.

          I set up a sample entry and exit condition with a signal name Powder, are you setting your entries/exits up like this?

          If after you make the change not using Position.Quantity, do you get the behavior you expect?
          Attached Files
          Last edited by NinjaTrader_AlanP; 10-18-2017, 09:31 AM.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_AlanP View Post
            Hello Liquid150,

            If you have 3 different sets of conditions which enter long and they are all uniquely named, you would need to have entries per direction set to 3 rather than 2, assuming you want to allow each to be executed.



            If you are long 1 and then one of your conditions to EnterShort is called, two orders will be submitted, 1 to flatten you up and 1 to get your short.

            I would suggest not using Position.Quantity in your exit calls and leaving quantity to default quantity.

            I set up a sample entry and exit condition with a signal name Powder, are you setting your entries/exits up like this?

            If after you make the change not using Position.Quantity, do you get the behavior you expect?
            Good evening Alan,

            Changing the exits to the order quantity used had the intended effect. Thank you for that. I'm not sure why Position.Quantity was behaving the way it did for me, which is not in alignment with the intended behavior from what I have experienced so far. I can't use Default.Quantity because my order quantities are variable.

            Also, I was able to resolve my other issue with some logic, so thanks for your help!!
            Last edited by liquid150; 10-19-2017, 06:26 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by alifarahani, Today, 09:40 AM
            6 responses
            36 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            14 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X