![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Posts: 118
Thanks: 0
Thanked 0 times in 0 posts
|
When I execute the cancelOrder() functions, rather than it actually cancel the order, internal NT will always report Cancelled Expired order instead. Is that make sense? Can you explain how CancelOrder work internally?
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
xewoox,
CancelOrder() is only for IOrders that you specifically told to stay alive via the liveUntilCancelled parameter. Otherwise, if you do not resubmit your order to keep it alive on every bar it will just automatically cancel.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2008
Posts: 118
Thanks: 0
Thanked 0 times in 0 posts
|
So how can you cancel your order in next ticks (in real time as soon as possible)
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Use CalculateOnBarClose = false and call CancelOrder whenever you want to cancel.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2008
Posts: 118
Thanks: 0
Thanked 0 times in 0 posts
|
Please try this script, I have it. It does not work.
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Dec 2008
Posts: 118
Thanks: 0
Thanked 0 times in 0 posts
|
The actual script
|
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Your script is telling it to CancelOrder only when you orderOut is true. orderOut is only true when your OrderState reaches a cancelled state. If it has reached a cancel state already there is nothing to cancel. That is why your CancelOrder() doesn't do anything.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How does this work? | SystemTrading | ATM Strategies (Discretionary Trading) | 3 | 12-09-2008 07:24 AM |
| Simple Limit Strategy with CancelOrder | stefy | Strategy Development | 7 | 11-10-2008 07:44 AM |
| CancelOrder() problem | John833 | Strategy Development | 41 | 10-31-2008 03:15 PM |
| doesn't work | Gregory Arkadin | Charting | 11 | 07-31-2008 07:58 AM |
| Strategy doesn't work somehow | Gordon_Gekko | Strategy Development | 4 | 11-06-2007 12:10 AM |