Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong() / ExitShort() on unmanaged approach

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

    ExitLong() / ExitShort() on unmanaged approach

    Hi,

    I want to exit my position when I'm not flat and I don't have any orders sent to the market because for example an error with my exits orders.

    I have been looking on the forum how can I create similar orders to ExitLong() / ExitShort() on unmanegd approach but I can't find anything.

    Can you help me where can I find it or how can I program it?

    Thanks


    #2
    Hello aprendiz,

    Thanks for your post.

    You can call SubmitOrderUnmanged with an OrderAction.BuyToCover or OrderAcion.Sell for Position.Quantity to close the strategy position.

    I.E.

    Code:
    if (Position.MarketPosition == MarketPosition.Short)
    {
        SubmitOrderUnmanaged(1, OrderAction.BuyToCover, OrderType.Market, Position.Quantity, 0, 0,  ocoString, "Buy Market Exit");
    }
    Position - https://ninjatrader.com/support/help...8/position.htm

    Please let us know if you have any additional questions.

    Comment


      #3
      Thanks.

      Is posible to know how many contracts has the opened position?

      Comment


        #4
        Hello aprendiz,

        This is reported from Position.Quantity.

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        478 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        319 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        258 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        341 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        309 views
        0 likes
        Last Post CarlTrading  
        Working...
        X