greetings and thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Order is canceled on every OnBarUpdate()
Collapse
X
-
Order is canceled on every OnBarUpdate()
I have a strategy with a method which compares the current price with a variable (entry price) and enters a stop or limit order, the problem is that if the order is not executed before creating another candle it is closed automatically in OnBarUpdate() , I would like the order to stay until the price arrives or I cancel it manually.
greetings and thanksTags: None
-
Hello villarroel0401,
Thank you for your post.
The default behavior for NinjaTrader is to cancel limit orders if the trigger conditions are no longer true. You could consider using the order method syntax that allows you to set isLiveUntilCancelled to true. This is considered an Advanced Order Handling concept; more information about Live Until Cancelled Orders may be found here:We also have a reference sample strategy that demonstrates this concept of "keeping orders alive" here:With a live until canceled order, you could use the CancelOrder() method to cancel the order if desired:Please let us know if we may be of further assistance.
-
Hello, I am dealing with a similar issue. I have a 3 candle patter strategy that based on the conditions of those 3 candle it'll place a Buy Stop or sell stop @ candle 1 High or low. The problem is at bar open the pending order will auto cancel I don't know why, I'm assuming it's because the condition is no longer met?.. at any rate how do I set it to place the pending order and NOT auto cancel? I read what you posted in this thread but I have no clue as to how to implement this code, Do I need to actually open the code and paste in code somewhere? or can this be accomplished within the strategy builder, like is there a keep orders live or do not auto cancel pending orders somewhere within the builder? As much detailed help with is issue would be greatly appreciated as I am very new at using NT. Thanks.Originally posted by NinjaTrader_Emily View PostHello villarroel0401,
Thank you for your post.
The default behavior for NinjaTrader is to cancel limit orders if the trigger conditions are no longer true. You could consider using the order method syntax that allows you to set isLiveUntilCancelled to true. This is considered an Advanced Order Handling concept; more information about Live Until Cancelled Orders may be found here:We also have a reference sample strategy that demonstrates this concept of "keeping orders alive" here:With a live until canceled order, you could use the CancelOrder() method to cancel the order if desired:Please let us know if we may be of further assistance.
Comment
-
Hello NWVW22,
Thank you for your note and welcome to the NinjaTrader forum community!
In the Strategy Builder, an order will be canceled as soon as the condition is no longer true. There is no option to set IsLiveUntilCanceled to true in the Strategy Builder - that is only available for unlocked NinjaScript strategies. You could consider something like using a bool (true/false) variable that is set to true when the desired conditions are met. Next, you would set up a different condition set that checks if the position is flat and that the bool is true, and then has the action of submitting the order. The bool can remain true for several bars moving forward, then you can reset it back to false when you no longer need the order submitted.
This process is also described in other forum posts, such as the following:
hello im in the progress of switching to ninjatrader im trying to create a strategy with strategy builder, when conditions are met to place a pending buy stop or enterlongstop order at the indicator value of the swing indicator and then cancel the stop order if the swing indicator has plotted a new value
A bool can be set up on the "Inputs and variables" screen of the builder and then used in conditions and actions to check if it is true/false or to change its value between true/false.
Please let us know if we may be of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|
Comment