Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnPositionUpdate Err - Order quantity has to be greater/equal 0

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

    OnPositionUpdate Err - Order quantity has to be greater/equal 0

    Greetings,
    In the log, I'm getting the message "Error on calling 'OnPositionUpdate' method for strategy ..... : Order quantity has to be greater/equal 0". What would cause this error message ? Below is the section of code, very slightly stripped down, that I believe is causing the error.
    Thank you,
    Bruce

    protectedoverridevoid OnPositionUpdate(IPosition position)
    {
    ORTrdPositionCurr = position.Quantity;
    if (ORTrdPositionCurr < ORTrdPositionPrior)
    {
    ChangeOrdersStopLoss(ORTrdPositionCurr, ORTrdAllowed);
    }
    ORTrdPositionPrior = ORTrdPositionCurr;
    }

    #2
    Hi there, I don't think any of the code you've posted shows the error. Basically it looks like you are trying to either change or submit an order with a quantity of 0. Please set TraceOrders = true in the Initialize() section of your code and see if that spits out any additional information.

    If it doesn't, can you instead post the code to the ChangeOrdersStopLoss() method?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thank you very much, Austin. You cleared away my confusion as to the problem being directly in the "OnPositionUpdate" section coding. That's what I needed. By the way, what kind of coffee are you drinking, I want some !!! Your response time was FOUR minutes !!! OUTSTANDING, to say the least !!
      Bruce,
      Ninja Lifer

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X