Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnPositionUpdate & OnOrderUpdate

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

    OnPositionUpdate & OnOrderUpdate

    Hi,

    I have a question with regards to the following;

    OnPositionUpdate(IPosition position)

    Code:
    if (position.MarketPosition == MarketPosition.Long) priorTrade = position.AvgPrice;
    OnOrderUpdate(IOrder order)
    Code:
    if (order.OrderState == OrderState.Filled) priorEntry = order.AvgFillPrice;
    After using both of the above types I want to confirm the output when using Print...is it normal for both of them to continually print 0 to the output screen when their is no position?

    The code runs as expected but because I haven't done this before I was hoping for some feedback. I'd also like to ask is their any benefit to using one over the other or are they essentially the same?

    Regards,
    suprsnipes

    #2
    Hello,

    The differences between them are detailed at the top of each of these links:



    Note that they are only called when there is an event, so they will do nothing (will not be called) when there is no change in state.
    DenNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X