There are a number of threads about this, and none of them actually answer the question. They all talk about setting it to a large value that wont execute, but that is not reset. I want a true reset that will not submit any stop orders for a new entry. Is there a special value like double.MinValue that can be passed in to actually reset the function until a later call?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Reset SetStopLoss
Collapse
X
-
Reset SetStopLoss
How can SetStopLoss be reset back to default behavior of not doing anything?
There are a number of threads about this, and none of them actually answer the question. They all talk about setting it to a large value that wont execute, but that is not reset. I want a true reset that will not submit any stop orders for a new entry. Is there a special value like double.MinValue that can be passed in to actually reset the function until a later call?
Tags: None
-
Hello aslane,
Thanks for your post.
One approach you could take would be to only use signal names for your SetStopLoss. When an entry using a matching signal name as the stoploss, the stop loss would be used. If the entry does not match then no stop loss would be used.
Here is a quick example you can test:
if (CurrentBar == 500)
{
SetProfitTarget("myTest", CalculationMode.Ticks, 10);
SetStopLoss("myTest", CalculationMode.Ticks, 10, false);
EnterLong("myTest");
}
if (CurrentBar == 1500)
{
EnterLong();
}
What would happen is that the first entry would end with either the stop or target filled. In the case of the 2nd entry, it would end at the session (if exit on session set).
I am unsure if the above approach would meet your needs so I will create a feature request to allow for the ability to "turn off" the Set methods. If this already exists, your vote will be added to it. In either case I will update this thread when I have further information on the feature request.
-
The only alternative is to use Enter and Exit methods directly such as:
ExitLongStopMarket(...)
ExitShortStopMarket(...)
This is not as convenient as SetStopLoss, but you have more flexibility.
In managed mode you would just call ExitLongStopMarket in each OnBarUpdate to keep it alive.
If you are trying to emulate multiple stops or transitioning stops, like starting with a fixed stop and then transitioning to a trailing stop at X ticks above breakeven, you just need to track the stop price(s) yourself and update the stop order price on each bar.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
41 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment