Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unable to cancel order in ninjascript.

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

  • greenberet
    replied
    Hello Chelsea.
    waow thank you, it worked. i will share the updated version just for future reference on how it's fixed. thank you again !!
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello greenberet,

    To cancel an order it will need to be in a working or accepted state.

    The Orders collection can be retrieved from an Account object
    Help guide: NinjaScript > Language Reference > Add On > Account > Orders​

    Orders can be cancelled by supplying the object to <Account>.Cancel().
    Help guide: NinjaScript > Language Reference > Add On > Account > Cancel()

    foreach (Order order in myAccount.Orders.ToList())
    {
    if (order.OrderState == OrderState.Working || order.OrderState == OrderState.Accepted)
    {
    myAccount.Cancel(new Order[] { order });
    }
    }​

    Leave a comment:


  • greenberet
    started a topic unable to cancel order in ninjascript.

    unable to cancel order in ninjascript.

    I have looked at the documentation and made a simple script, everything is being detected, the order is being detected, but when issuing the cancel() method, nothing happens.
    how can I debug this any further ?
    to give some context, I am just trying to learn ninjascript to do more advanced tasks, but as a starter, I am trying to develop an add-on, that will monitor my accounts, if there are any open orders, it cancels them. i have attached the cs script, and a screenshot of the log output. would appreciate some insights, perhaps I am missing something in the documentation or maybe the documentation is not up to date ? thanks in advance.
    Click image for larger version

Name:	image.png
Views:	152
Size:	10.4 KB
ID:	1311233

Latest Posts

Collapse

Topics Statistics Last Post
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
597 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
343 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
103 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
556 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
555 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X