Say I place a limit order... then after 10 seconds pass, I want to cancel the order.... so I can place it again anything of the such?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Cancelling limit orders based off of time...
Collapse
X
-
Cancelling limit orders based off of time...
Is there a stopwatch feature in Ninja Trader that allows me to cancel orders based off of time?
Say I place a limit order... then after 10 seconds pass, I want to cancel the order.... so I can place it again anything of the such?Tags: None
-
BigDog008, please take a look at this sample for custom timer events used in NinjaScript - http://www.ninjatrader-support2.com/...ead.php?t=5965
-
For a basic start you can check into the snippet we have on the CancelOrder page - http://www.ninjatrader-support.com/H...ncelOrder.html
This could of course also be done after the order reports for example filled (checking IOrder object fillstates).
Comment
-
the cancelorder page seems that will do it, However what would you suggest to replace barNumberOfOrder with that would put it in a Time parameter? Or could i use barNumberOfOrder and set that equal to something other than CurrentBar that would also put it into seconds or milliseconds.
Comment
-
barNumberofOrder is used as a variable in the help file.
http://www.ninjatrader-support2.com/...ead.php?t=5965
In the cancel example, barNumberofOrder variable is set = 0, and then set as Currentbar which is an int. What variable type would I create if I later want to set it to a time format (seconds or millisecs).
So, if I used the cancel example:
private IOrder myEntryOrder = null;
private ?? variable = 0;
protected override void OnBarUpdate()
{
// Submit an entry order at the low of a bar
if (myEntryOrder == null)
{
myEntryOrder = EnterLongLimit(0, true, 1, Low[0], "Long Entry");
variable = _Some Time Format_;
// If more than 5 bars has elapsed, cancel the entry order
if (_Some Time Format_ > variable + 5)
CancelOrder(myEntryOrder);
}
hope i made sense...
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
64 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
35 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
59 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment