Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketPosition - OrderState

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

    MarketPosition - OrderState

    Hello,

    I couldnt find how to do in NT-script to check if a certain position is long with

    * "Position.MarketPosition == MarketPosition.Flat"

    * "if (execution.Order != null && execution.Order.OrderState == OrderState.Filled)"

    I can check if there is any long or filled. But how to do please for knowing eg if "B" (from the sample with A, B, C here) is long (or filled)

    EnterLongt(1000, "A");
    EnterLong(1000, "B");
    EnterLong(1000, "C");

    How to do with MarketPosition and howto do with orderstate in OnExecution please?

    Thanks
    Tony

    #2
    Tony, the MarketPosition would always be your overall strategy position - you would need to assign an individual IOrder for each partial order / position and then check it's state then:

    Comment


      #3
      Thank you!

      Is there a possibilty to recognize (and to do in the script an " if... then...") when a stoploss is triggered? With exitlong or exitshort I can work with and do drawing, sounds, other condtions ..... but how can I have eg a certain action or maybe drawing (eg backgrund coloring) when a stoploss is triggered?

      Thanks and best regards
      Tony



      Originally posted by NinjaTrader_Bertrand View Post
      Tony, the MarketPosition would always be your overall strategy position - you would need to assign an individual IOrder for each partial order / position and then check it's state then:

      http://www.ninjatrader.com/support/h...nt7/iorder.htm

      Comment


        #4
        Hi Tony, you would check for the execution state reporting .Filled for your stop loss order, if you work with the Set method then this sample applies as the Set method would not natively expose IOrder info -

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        65 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        23 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        26 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        52 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X