My strategy does a trailing stop.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
SetStopLoss() in OnBarUpdate if position flat?
Collapse
X
-
SetStopLoss() in OnBarUpdate if position flat?
Do I need to call SetStopLoss() to reset the stop whenever OnBarUpdate runs and position is flat?
My strategy does a trailing stop.Tags: None
-
Hello iantriestrading,
Thank you for your post.
If you want to dynamically change/modify the price of the stop loss and profit target, the method should be called from within OnBarUpdate() and the price should always be reset when the strategy becomes flat again.
Please note that SetStopLoss() cannot be used with SetTrailingStop(). This is noted in the Help Guide:
SetStopLoss() - https://ninjatrader.com/support/help...etstoploss.htm
"The SetStopLoss() method can NOT be used concurrently with the SetTrailStop() or SetParabolicStop() method for the same position, if any methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use all three methods in the same strategy if they reference different signal names."
Please let us know if you have any further questions.
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment