Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CancelOrder behaviour in a strategy

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

    CancelOrder behaviour in a strategy

    Hi

    I have a strategy which has a DailyStopLossLimit property. This strategy does nothing else except monitor my PL and compares to the DailyStopLoss. if my daily loss exceeds this level it closes all positions and attempts to cancel any new orders entered.

    However the strategy doesn't control new order entry. I do that manually. When the strategy calls CancelOrder on any new orders that i've manually entered nothing happens.

    Can strategies cancel orders that they didn't originally submit? If not is there a work-around?

    I've tried CancelAllOrders(Intrsument) which does indeed cancel any order but that also kills the strategy and i dont want that to happen.

    thanks

    #2
    Hello weav74,

    Thank you for the post.

    In this situation it sounds like you would want to use an indicator with Addon code rather than a strategy. Strategies cannot control external orders, they are intended to only control their individual orders.

    You could use the Addon account methods for this from an Indicator rather than using a strategy. https://ninjatrader.com/support/help...ount_class.htm

    The purpose of the addon account is to observe the account directly which would act similar to the existing tools, that means you can watch for manually placed orders and do logic to modify those orders.

    https://ninjatrader.com/support/help...nt8/cancel.htm

    https://ninjatrader.com/support/help...lallorders.htm

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

    Comment


      #3
      Hi Jesse
      Perfect. Exactly what i was looking for. Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Franck Z, Today, 09:49 AM
      0 responses
      4 views
      0 likes
      Last Post Franck Z  
      Started by pvtrader, Today, 08:02 AM
      2 responses
      7 views
      0 likes
      Last Post pvtrader  
      Started by Natoc, Today, 03:04 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by Rudy2323, Today, 02:56 AM
      2 responses
      27 views
      0 likes
      Last Post Rudy2323  
      Started by tonynt, Yesterday, 02:07 PM
      1 response
      34 views
      0 likes
      Last Post NinjaTrader_Jason  
      Working...
      X