Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How To Cancel / Remove the Stop Loss setting?
Collapse
X
-
How To Cancel / Remove the Stop Loss setting?
When SetStopLoss () is first called, it sets an internal value that is used to automatically generate stop loss orders when an order execution is filled. My question is, how do I remove (get rid of) a SetStopLoss setting ? I only use stop losses during certain types of trades, and I do NOT want them used during other trades. I can't seem to find out how to do this very simple thing. Any help will be greatly appreciated.Tags: None
-
Hello Plan 9,
Set methods cannot be unset and orders from Set methods are not intended to be cancelled.
The Set methods are intended to be used and left to manage the order, and it's suggested to use Exit methods (like ExitLongStopMarket()) if you are wanting to have control of cancelling the exit orders.
https://ninjatrader.com/support/help...stopmarket.htm
https://ninjatrader.com/support/help...ancelorder.htm
https://ninjatrader.com/support/help...thod_to_ca.htm
If a position is closed that initiated a Set method placed order, the Set placed order will automatically be cancelled. So if you call ExitLong() it will cancel any stop loss on that position automatically.
https://ninjatrader.com/support/help...etstoploss.htm
Below are links to examples you may find helpful.
Chelsea B.NinjaTrader Customer Service
-
So it sounds like until SetStopLoss( ) is called for the first time, there is none. But once SetStopLoss( ) is called for the first time, you are stuck with it until you restart Ninjatrader, even if the strategy is managing stop losses on its own. It would be nice to have a reset function ResetStopLoss( ) that sets it back to the original OFF state.
Comment
-
Hello Plan 9,
Once SetSetLoss() is set, it continues to be set for new orders using that signal name until the strategy is disabled and re-enabled. Use a unique signal name if you don't want a preset set method after it has been called. And there is no reason to restart NinjaTrader.
Use Exit methods if you want control of cancelling orders.Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks. There is one last item that I cannot yet figure out regarding this. When I call SetStopLoss( ), and then open a position with EnterLong( ), the position opens and the stop loss is set. But I can't figure out how to change the stop loss price afterwards. For example, if my original global stop loss is 20 ticks, and after reaching a certain profit I want to change it to breakeven, how would I do it? I tried calling SetStopLoss( ) with the signal for the open position and the new stop price, but it does not seem to have any effect.
Comment
-
Hello Plan 9,
Thanks for your reply.
Here is an example:
if (your conditions to enter long)
{
SetStopLoss(CalculationMode.Ticks, 20); // sets the stop before the entry order
EnterLong();
}
if (Close[0] > Position.AveragePrice + 20 * TickSize) // if the bar close price is greater than 20 ticks above the entry
{
SetStopLoss(CalculationMode.Price, Position.Averageprice); // move the stop to breakeven
}
Note: Typically in the breakeven, you would also have a bool variable so that you only adjust the order once.Paul H.NinjaTrader Customer Service
Comment
-
Thanks, that led me to a discovery. I was trying to use the second method below, which does not work.
The first SetStopLoss( ) line below works, the second one doesn't.
if (entry conditions are true)
{
SetStopLoss(CalculationMode.Ticks, 20);
EnterLong("Long_1"); // entry signal
}
if (Close[0] > Position.AveragePrice + 20 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AveragePrice); // this works
// SetStopLoss("Long_1", CalculationMode.Price, Position.AveragePrice, false); // this does not work
}
So now I can get it to work. Thanks.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by zstheorist, Today, 07:52 PM
|
0 responses
3 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
149 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
5 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
Comment