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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      61 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      148 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      98 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      286 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X