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 kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    90 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    92 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    70 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    87 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    64 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X