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 burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    12 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,982 views
    3 likes
    Last Post jhudas88  
    Working...
    X