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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        56 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        132 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X