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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    38 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    287 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    289 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    134 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    95 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X