• 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 Johnny Santiago, Today, 06:18 PM
        1 response
        3 views
        0 likes
        Last Post Johnny Santiago  
        Started by EnveousColnago, Today, 05:43 PM
        0 responses
        4 views
        0 likes
        Last Post EnveousColnago  
        Started by Zigfried, Today, 02:30 PM
        2 responses
        8 views
        0 likes
        Last Post Zigfried  
        Started by lunardiplomacy, Today, 11:35 AM
        4 responses
        13 views
        0 likes
        Last Post lunardiplomacy  
        Started by silverm3170, Today, 11:24 AM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X