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 AaronKoRn, Today, 09:49 PM
    0 responses
    1 view
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    6 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    8 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,974 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X