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 DJ888, 04-16-2024, 06:09 PM
    4 responses
    12 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    9 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by nandhumca, Today, 03:41 PM
    0 responses
    6 views
    0 likes
    Last Post nandhumca  
    Started by The_Sec, Today, 03:37 PM
    0 responses
    3 views
    0 likes
    Last Post The_Sec
    by The_Sec
     
    Started by GwFutures1988, Today, 02:48 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X