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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.
Paul H.NinjaTrader Customer Service
-
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 DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
6 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
||
Started by timmbbo, Today, 08:59 AM
|
2 responses
10 views
0 likes
|
Last Post
by bltdavid
Today, 04:10 PM
|
||
Started by alifarahani, Today, 09:40 AM
|
6 responses
41 views
0 likes
|
Last Post
by alifarahani
Today, 03:18 PM
|
Comment