Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketPosition for a specific entry

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

    MarketPosition for a specific entry

    Hello,

    My strategy opens two long positions using different signal names. "Position.MarketPosition” gives me the overall current market position (long, short, or flat). How can I obtain the same information for a specific entry?

    Thank you.

    #2
    Hello dmitry75,

    Because it is not possible to have a long and short position at the same time, individual orders do not have a position method.

    You can however, find the order action of an individual order by using the IOrder handle. This would be whether its a buy, buy to cover, sell, or sell short.

    For example:
    private IOrder mylong = null;
    mylong = EnterLong();
    Print(mylong.OrderAction);

    Below is a link to the help guide on IOrder.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      But it is possible that Entry1 is opened and Entry2 is closed. My question is not "whether its a buy, buy to cover, sell, or sell short". I need to know how can I get each signal's current market position (in this case -- long or flat).

      Comment


        #4
        Hello dmitry75,

        It would be possible to check on the state of the order on whether it has filled, but each order contributes to either a strategy position or account position.

        To check to see if an order has filled using the IOrder handle use the OrderState.

        For example:
        private IOrder mylong = null;
        mylong = EnterLong();
        if (mylong.OrderState == OrderState.Filled)
        {
        // execute code
        }

        Below is a link to the help guide on IOrder.
        http://www.ninjatrader.com/support/h...tml?iorder.htm

        When it comes to using IOrder handles, I recommend that after an order fills you set this to null. Then you can check with the IOrder handle being null to know that the order is not in a working state.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          663 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          376 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X