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

Canceling a submitted order

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

    Canceling a submitted order

    Question:
    I am submitting a Stop order when Condition X is met. The order submits fine and shows up with a blue "Accept" in the Orders tab. However if Condition Y occurs (before order gets filled), I need to cancel the "accept"-ed order.
    How do I do this?

    Actually, what I really need to do is - if Condition Y occurs before order gets filled, then update the "accept"ed order with an new Stop value. So either cancel and resubmit, or update existing queued order.

    Problem is - I do not know how to find the handle to the pre-submitted order to issue this change (or cancellation)
    Last edited by nybangali; 10-24-2008, 02:00 AM.

    #2
    Hi nybangali,

    To cancel orders you need to use CancelOrder(). You can only use that if you have an IOrder object containing your order. What this means is when you submit orders you will want to do something like this:
    Code:
    // In Variables
    private IOrder stopOrder = null;
    
    // In OnBarUpdate()
    stopOrder = ExitLongStop(100);
    CancelOrder(stopOrder);
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bill2023, Yesterday, 08:21 AM
    2 responses
    14 views
    0 likes
    Last Post bill2023  
    Started by ynoldsany, Today, 01:00 AM
    0 responses
    3 views
    0 likes
    Last Post ynoldsany  
    Started by Carolscogginsi, Yesterday, 10:45 PM
    0 responses
    7 views
    0 likes
    Last Post Carolscogginsi  
    Started by RaddiFX, Yesterday, 10:15 AM
    2 responses
    15 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by patrickmlee007, Yesterday, 09:33 AM
    2 responses
    19 views
    0 likes
    Last Post patrickmlee007  
    Working...
    X