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

Strategy Builder Cancel Order

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

    Strategy Builder Cancel Order

    Is there an internal tracking number for cancelling an order within the Strategy Builder, rather than having to hand-code it?

    E.g. Conditions and Actions could have a Set to cancel a limit order if it's not filled within x bars.

    #2
    Hello IanS00,

    Thank you for your post.

    By internal tracking number, are you referring to a feature request ID number or something else? It is possible to cancel an order after X number of bars by using a bar counter in the Strategy Builder. There is an example of using a bar counter here:
    with regard to the attached image: Line A is an indicator Line B is the m period MAX of line A Line C is an average of this indicator A Line D is another average of this indicator A is it possible, possibly using the strategy builder, but without adding a temporary variable, to set on the condition: line C crosses below line D


    You could have a bool that allows the order to be placed, and then after x number of bars has passed the bool toggles so that the order condition is no longer met and it is canceled.

    Please let me know if I may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      I don't see any Strategy Builder selection for canceling orders, only for entering or exiting them. Does "Exit" cancel the order if it's not been filled?

      Comment


        #4
        Hello IanS00,

        Thank you for your reply.

        Exit() does not cancel an order. The Strategy Builder uses the Managed Approach. Whether you are using the Strategy Builder or an unlocked script with the Managed Approach, the default behavior for Enter() and Exit() methods is to automatically expire/cancel the order at the end of the bar unless they are "resubmitted" to keep the order alive. An order can be resubmitted/kept alive on the next bar as long as the condition for the order is still true. Once the condition is no longer true, the order will expire and be canceled. In an unlocked script, there is a way that you can use order methods with the IsLiveUntilCanceled property set to true, and this would allow you to use CancelOrder(). That is only available as an advanced order handling concept in an unlocked script and not available as an option in the Strategy Builder.

        More info regarding the Managed Approach may be found in the help guide here:


        Advanced Order Handling topics for unlocked scripts are described here:


        If you'd like, I could provide you with an example of how to let an order expire/cancel under certain conditions. What is the scenario you would like for an order to be canceled? For example, you could do something like submit an enter long limit order and if it is not filled in 5 bars, then cancel it. Once I have a better idea of what you are trying to achieve I would be glad to create a video and/or provide screenshots of the Strategy Builder demonstrating how it could be done.

        I look forward to your reply.
        Emily C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        58 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        4 responses
        3,285 views
        1 like
        Last Post jgualdronc  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        5 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        22 views
        0 likes
        Last Post halgo_boulder  
        Started by mishhh, 05-25-2010, 08:54 AM
        19 responses
        6,189 views
        0 likes
        Last Post rene69851  
        Working...
        X