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!
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
NinjaTrader
Cancel Pending Orders
Collapse
X
-
Cancel Pending Orders
Using Strategy Builder (not NinjaScript), how can I cancel a pending limit order that was placed by the same strategy, if a certain condition is met. Important to this is that I'm not wanting to go flat on that instrument, in case there is already an open position there.Tags: None
-
Hello nathanc78,
Thanks for your post.
There is no means to cancel orders in the strategy builder.
Limit orders in the Strategy builder will automatically be canceled at the end of the bar they are submitted on.
"By default, orders submitted via Entry() and Exit() methods automatically cancel at the end of a bar if not re-submitted" Reference: https://ninjatrader.com/support/help...d_approach.htm
Paul H.NinjaTrader Customer Service
-
Hello nathanc78,
Thanks for your reply.
Typically what one would do is when the conditions are met for placing an order, what you would do is to set a bool variable from false to true and save the limit entry price into a double variable. In another set you would check that the bool is true and that the market position is flat and then submit the limit order with the saved price. This will continue until the bar fills the limit order or you turn off the bool.
You may need another set to determine in another condition when to turn off the bool.
Paul H.NinjaTrader Customer Service
Comment
-
Thank you! That makes sense...one follow up question: Let's say on the next set I'm evaluating the whether the boolean is true and whether the market position is flat. And let's say it's flat. But, it's only flat because the Profit Target was already hit?
Another question: what if market position isn't flat but the position on is from a different strategy? If I evaluate for 'market position is flat', will that condition only evaluate positions from the current strategy? or all strategies on that instrument?
Comment
-
Hello nathanc78,
Thanks for your reply.
"Let's say on the next set I'm evaluating the whether the boolean is true and whether the market position is flat. And let's say it's flat. But, it's only flat because the Profit Target was already hit?" So this is a timing question. If a profit target is filled that would happen asynchronously to the strategy execution and takes time for the position object to be updated from Long/short to flat. The strategy execution depends on the "Calculate" setting. You would need to test your strategy on the sim101 account to understand if you will have any issues.
"what if market position isn't flat but the position on is from a different strategy? If I evaluate for 'market position is flat', will that condition only evaluate positions from the current strategy? or all strategies on that instrument?" Each strategy runs independently and is not aware of any manual orders or orders from other strategies, so yes it only evaluates its orders/positions and not any others. We would advise to only run one strategy on an instrument to avoid the out of sync condition you would experience which would lead to unexpected orders.
Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by JGriff5646, Today, 10:02 PM
|
0 responses
1 view
0 likes
|
Last Post
by JGriff5646
Today, 10:02 PM
|
||
Started by AdamDJ8, Today, 09:18 PM
|
0 responses
2 views
0 likes
|
Last Post
by AdamDJ8
Today, 09:18 PM
|
||
Started by knowmad, Today, 03:52 AM
|
2 responses
27 views
0 likes
|
Last Post
by knowmad
Today, 09:03 PM
|
||
Started by ETFVoyageur, Today, 07:05 PM
|
0 responses
10 views
0 likes
|
Last Post
by ETFVoyageur
Today, 07:05 PM
|
||
Started by Orion815, 05-02-2024, 08:39 AM
|
2 responses
18 views
0 likes
|
Last Post
by Orion815
Today, 06:24 PM
|
Comment