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

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:



          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 adeelshahzad, Today, 03:54 AM
          4 responses
          25 views
          0 likes
          Last Post adeelshahzad  
          Started by merzo, 06-25-2023, 02:19 AM
          10 responses
          823 views
          1 like
          Last Post NinjaTrader_ChristopherJ  
          Started by frankthearm, Today, 09:08 AM
          5 responses
          17 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          43 views
          0 likes
          Last Post jeronymite  
          Started by yertle, Today, 08:38 AM
          5 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X