Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Submitted Order Size Does Not Work

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

    Submitted Order Size Does Not Work

    Hello Ninjatrader Staff,

    I keep having the same problem appear over and over again and I am at loss at what I'm doing wrong. Please see the attached image.
    Why is it that the submitted quantity is not correct? I have used Print() to tell me what the "Position.Quantity" is and it always returns 2 when "ATP2" is Filled, yet it seems to not translate into the submitted order quantity.

    This is the entry method for ATP2

    if (ATP2 == null
    && Position.MarketPosition == MarketPosition.Flat
    && Close[0] > KyoriBands2(TwentyFive, Fifty, SeventyFive, Hundred).Low4[0] + 5 * TickSize
    && Close[0] < KyoriBands2(TwentyFive, Fifty, SeventyFive, Hundred).Low2[0]
    && Low[0] < KyoriBands2(TwentyFive, Fifty, SeventyFive, Hundred).Low2[0])
    {
    EnterLongMIT(0, true, Contracts, KyoriBands2(TwentyFive, Fifty, SeventyFive, Hundred).Low4[0], "ATP2");
    }


    The strange thing is that when I remove "ATP2 == null" — then the script actually does submit both orders correctly.
    And taking a closer look at it while running on Simulated Data Feed over the weekend, while running with Calculate.OnPriceChange, it seems to be submitting one TP34/SL34 on the first price movement, and then the script submits the second TP34/SL34 on the second price movement. Why is this not happening together at once?

    I'm looking forward to your reply, because this has been a very puzzling issue.

    Edit 1:

    You can see that I have a CancelOrder() for both TP34/SL34 right above where the orders are submitted, and I can tell you that this is not causing the issue because the issue has been occurring even before I had those CancelOrder()'s installed.

    Edit 2:

    Even using the number 2 instead of "Position.Quantity" does not work.

    Edit 3:

    This line of code does work correctly, Contracts is a variable

    EnterShortStopMarket(0, true, Contracts, KyoriBands2(TwentyFive, Fifty, SeventyFive, Hundred).Low2[0], "AS1");
    Attached Files
    Last edited by GLFX005; 07-13-2020, 12:43 PM.

    #2
    A strange occurrence where it works on one order but not on the other?
    Attached Files
    Last edited by GLFX005; 07-13-2020, 01:22 PM.

    Comment


      #3
      Hello GLFX005,

      Thank you for your post.

      If I'm understanding correctly, the issue is that the strategy is not fully protecting your position, is that correct?

      To determine what may be occurring, we would need you to provide a reduced test strategy that only demonstrates this issue - all other code should be removed. If you're comfortable with posting that here, you can attach the reduced example to your reply. If you'd rather not post it publicly, you can send it via email to platformsupport [at] ninjatrader [dot] com. If you send it that way, please include "2650818 ATTN Kate W." in the subject line and a link to this post in the body of the email.

      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #4
        Hello Kate,

        Just a different question. Why am I unable to have a reverse Entry both above and below my position at the same time? This seems to be interfering with Managed Approach order handling rules, but I don't exactly understand the reasoning behind that.
        Last edited by GLFX005; 07-13-2020, 03:03 PM.

        Comment


          #5
          Hello GLFX005,

          Thank you for your reply.

          Yes, that would run afoul of the order handling rules, specifically this one:

          A position is open and two or more Entry methods to reverse the position are entered together. In this case the second Entry order will be ignored.

          This is to keep you from accidentally doubling your position since you can't submit the entry orders as OCO linked using the Managed approach. To get around this you would need to use the Unmanaged approach instead.

          Here's a link to our help guide that goes over the handling rules for the Managed approach:

          https://ninjatrader.com/support/help...antedPositions

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Cross161, Today, 10:33 PM
          0 responses
          3 views
          0 likes
          Last Post Cross161  
          Started by neilzep, Today, 08:55 PM
          0 responses
          6 views
          0 likes
          Last Post neilzep
          by neilzep
           
          Started by javier.filgueira, Today, 03:29 PM
          3 responses
          10 views
          0 likes
          Last Post javier.filgueira  
          Started by Da vinci, Today, 03:15 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by Da vinci, Today, 02:51 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X