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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
163 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
81 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
125 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
206 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
184 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment