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 minds2010, Today, 03:38 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by DTSSTS, Yesterday, 07:11 PM
      2 responses
      32 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by ntbone, Yesterday, 11:42 PM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by mr_trade, 11-26-2020, 05:01 PM
      5 responses
      59 views
      0 likes
      Last Post mr_trade  
      Started by evanp90, 01-14-2021, 07:03 PM
      4 responses
      33 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X