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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X