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 Barry Milan, Today, 10:35 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by WeyldFalcon, 12-10-2020, 06:48 PM
    14 responses
    1,427 views
    0 likes
    Last Post Handclap0241  
    Started by DJ888, Yesterday, 06:09 PM
    2 responses
    9 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    40 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Today, 08:51 AM
    2 responses
    16 views
    0 likes
    Last Post bill2023  
    Working...
    X