Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Update StopLoss real time
Collapse
X
-
Update StopLoss real time
I would like to change the stoploss when price hit some value but, I am using setstoploss in onbarupdate then, it is updatin only after the bar close. How can I update in real time? ThanksTags: None
-
Hello wagner4691,
Thanks for your post.
In order for the SetStopLoss to update sooner (real time), on live or replay data, you would need to run your strategy with Calculate.OnEachTick or Calculate.OnPriceChange. Either of these will cause your script to run as a new tick is received or as a change in price occurs, keep in mind that this means your strategy code may run hundreds of times (or more or less) per bar compared to once per bar as it does now.
You may want to segment some of your code so that it runs on the live data and some so that it only runs once per bar. Here is a link to an example of that: https://ninjatrader.com/support/help...either_cal.htm
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
88 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
134 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
119 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