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 CarlTrading, Yesterday, 11:51 AM
    0 responses
    12 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, Yesterday, 11:48 AM
    0 responses
    19 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-25-2026, 09:53 PM
    0 responses
    16 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 03-25-2026, 09:51 PM
    0 responses
    13 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 03-23-2026, 11:13 AM
    0 responses
    18 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X