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 NullPointStrategies, Today, 05:17 AM
|
0 responses
52 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
48 views
0 likes
|
Last Post
|

Comment