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 techgetgame, Yesterday, 11:42 PM
    0 responses
    8 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,613 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Yesterday, 05:56 PM
    0 responses
    10 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    20 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Working...
    X