Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trailing Stops
Collapse
X
-
Trailing Stops
Hi, I seem to only be able to get trailing stops to work using "Tick Replay" When I back test using high resolution order fill on 1 tick or even 1 second, it just simply doesn't work. I have the data for it and can't understand why it's only showing the trailing exits when "tick replay" is checked off. Shouldn't it also show them when using high resolution order fills?Tags: None
-
Hello,
Thanks for writing in.
In a backtest, this behavior is expected since when "Tick Replay" is enabled, it updates OnBarUpdate() on every tick and not OnBarClose. If your calculation is set to OnBarClose, and Tick Replay is not enabled, this means that OnBarUpdate() method will only update every time the bar closes. This also means that any logic(your Trailing stops) inside OnBarUpdate will only update when the bar closes. For example, if you have a 5-minute bar series loaded, OnBarUpdate() will only update every 5 minutes, when the bar closes. Also, High order fill resolution and Tick Replay cannot be used at the same time.
To improve the accuracy of your backtest and make sure your trailigstops are getting triggered, you can add a one-tick series(which you already did) for intra-bar granularity to improve order fill accuracy and TickReplay to allow indicators to update with Calculate.OnPriceChange/.OnEachTick in historical data. This has to be done in an unlocked script, since you will have to submit your orders to your added one-tick series.
The Link below contains a more in-depth review of how this can be accomplished as well as sample code.
https://support.ninjatrader.com/s/ar...language=en_US
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
87 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
128 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
65 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
117 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
67 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment