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 DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Working...
        X