Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Indicator trailing stop for price pulled back and made new highs
Collapse
X
-
Indicator trailing stop for price pulled back and made new highs
Hi, i loock for a indicator to use as trailing stop, the indicator detect price pulled back and then made new highs, like in the picture below. Some body has an example to do that?
ThanksTags: None
-
Hello Pbarrionuevo,
Thanks for your post.
The key to creating a trailing stop behavior is to keep track of the last price or plot value when the stop is moved, and to check if the current plot or current price is above that last price/plot value before adjusting the stop loss again.
I would suggest reading the plot in the strategy, and then to use logic in your strategy to control when the stop loss updates. The example below demonstrates on how you can move stop loss prices. You could consider logic that instead of comparing Close[0] (current market price) to Position.AveragePrice, you compare Close[0] (or your plot) to a variable and make sure the market has moved X number of ticks from your variable. Then you can call SetStopLoss to update the stop price and also update your variable so it notes the last price when the stop was changed.
SamplePriceModification - https://ninjatrader.com/support/help...of_stop_lo.htm
Working with Price Series - https://ninjatrader.com/support/help...ice_series.htm
Please note that if you are calling SetStopLoss in OnBarUpdate, you will need to make sure that the strategy has the stop loss reset to an initial level when the strategy position is flat, and before a new entry is made. This is also demonstrated in the example above.
You may also consider using SetTrailStop to use a trailing stop, but this would not be a stop loss that you could control with your own logic.
SetTrailStop - https://ninjatrader.com/support/help...ttrailstop.htm
We look forward to assisting.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
563 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
329 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment