Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position.MarketPosition == MarketPosition.Long

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

    Position.MarketPosition == MarketPosition.Long

    In the context of OnBarUpdate

    if ( conditions )
    {
    entryorder = EnterLong(Quantity, label);
    }


    If these four conditions below are TRUE:
    order == entryorder
    order.OrderState == OrderState.Filled
    order.OrderState != OrderState.PartFilled
    order != null



    Is this condition below ALWAYS going to be TRUE?
    Position.MarketPosition == MarketPosition.Long



    Thanks

    #2
    Hello Stratagemma,

    While if an order fills this will create a long position, this will happen asynchronously. Meaning there may be a moment before OnPositionUpdate runs where the Position.MarketPosition has not yet been updated.

    Also, if another order gets you out of the trade, the MarketPosition is no longer long, so this will not stay true.

    So I can't say thats exactly always true, but in a general sense, yes it mostly will be.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    60 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    39 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    20 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    22 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    51 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X