-thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Send stop order within same bar as entry
Collapse
X
-
Send stop order within same bar as entry
I have a strategy that works on CalculateOnBarClose=true. When it enters an order (mkt) at the next bar open, the strategy waits until the next bar to enter a stop order using ExitLong(Short)Stop(). Is there a simple way of sending a stop order when the entry order is filled? I don't use SetStopLoss() because the value is based on ATR and thus not fixed for the whole strategy.
-thanksTags: None
-
laparker, I think you could still use SetStopLoss with the ATR value in the OnBarUpdate() then for this. Another solution is to move this to the OnExecution() to send the stop once the entry order is filled -
The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
-
Bertrand - your example relates to using OnExecution() which would be a big code change and learning curve for me. Using SetStopLoss() looks like I can keep within OnBarUpdate() but I don't see how to cancel the previous SetStopLoss(). Do I include a new SetStopLoss() order when flat and before the new entry order and if so, what do I use as the value?
-thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
651 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|
Comment