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 CarlTrading, Yesterday, 09:41 PM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, Today, 02:41 AM
        0 responses
        6 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, Yesterday, 11:44 PM
        0 responses
        17 views
        0 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        33 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        32 views
        0 likes
        Last Post CarlTrading  
        Working...
        X