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:

    BertrandNinjaTrader Customer Service

    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 -

        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Conceptzx, 10-11-2022, 06:38 AM
        3 responses
        60 views
        0 likes
        Last Post NinjaTrader_SeanH  
        Started by f.saeidi, Today, 01:32 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by mmckinnm, Today, 01:34 PM
        0 responses
        3 views
        0 likes
        Last Post mmckinnm  
        Started by traderqz, Today, 12:06 AM
        9 responses
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        117 responses
        2,766 views
        1 like
        Last Post jculp
        by jculp
         
        Working...
        X