Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel open orders after profit target hit

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

    Cancel open orders after profit target hit

    Hi,

    How can I cancel any remaining open orders after a profit target has been hit, or a position has been closed?

    I was thinking of using the CancelOrder(IOrder) method inside the OnPositionUpdate and check for Position.MarketPosition = MarketPosition.Flat ... Is this the proper way to go?

    #2
    Hello,

    For this you may want to look at this sample: http://www.ninjatrader.com/support/f...ead.php?t=7499

    I believe for this you would want to use OnExecution instead of OnPositionUpdate.

    This is a good example of comparing IOrder objects, you could in turn use something like this as a base framework for detecting fills and then use the CancelOrder method when one of your orders is filled, then you can cancel your other order objects.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    11 responses
    39 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by FrazMann, Today, 11:21 AM
    0 responses
    3 views
    0 likes
    Last Post FrazMann  
    Started by geddyisodin, Yesterday, 05:20 AM
    8 responses
    52 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by DayTradingDEMON, Today, 09:28 AM
    4 responses
    26 views
    0 likes
    Last Post DayTradingDEMON  
    Started by George21, Today, 10:07 AM
    1 response
    22 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X