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 aussugardefender, Today, 01:07 AM
        0 responses
        1 view
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        383 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        1 view
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Working...
        X