• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Andreas M., Today, 04:42 PM
        0 responses
        1 view
        0 likes
        Last Post Andreas M.  
        Started by sidlercom80, Today, 12:29 PM
        2 responses
        21 views
        0 likes
        Last Post fx.practic  
        Started by itrader46, Today, 02:49 PM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by m94306, Today, 03:01 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Heath  
        Started by fx.practic, Today, 02:54 PM
        3 responses
        10 views
        0 likes
        Last Post fx.practic  
        Working...
        X