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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    46 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X