Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.





    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 pechtri, 06-22-2023, 02:31 AM
      9 responses
      122 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by frankthearm, 04-18-2024, 09:08 AM
      16 responses
      66 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by habeebft, Today, 01:18 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by benmarkal, Today, 12:52 PM
      2 responses
      14 views
      0 likes
      Last Post benmarkal  
      Started by f.saeidi, Today, 01:38 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X