Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Close By Stop Loss
Collapse
X
-
Hello kiss987,
Thank you for writing in. You can know how a position was closed by checking the Name column and the Filled column of the orders tab of either the control center or the strategy analyzer (depending on how you are running your strategy). You will see "Stop loss" as the name, and an amount greater than 0 in the "Filled" column indijcating that a position was exited through the SetStopLoss() method.
More information on the SetStopLoss() method can be found in our help guide here: http://ninjatrader.com/support/helpG...ub=setstoploss
If you need to know if your position was closed by the order placed from the SetStopLoss() method in code, it could look something like this:
The code above is called on an incoming execution. It checks if the execution's order exists, if the order state is now filled, and if the order is a stop loss order.Code:protected override void OnExecution(IExecution e) { if(e.Order != null && e.Order.OrderState == OrderState.Filled && e.Order.Name.ToString() == "Stop loss") { //Do something } }
More information on the OnExecution() method can be found in our help guide here: http://ninjatrader.com/support/helpG...ub=onexecution
Please let us know if we may be of further assistance.Michael M.NinjaTrader Quality Assurance
-
Hello,
When using SetProfitTarget() it will have a default name of ProfitTarget.
EnterLong and ExitLong do not have default names but you can name them by entering a string in between the parantheses.
This example would enter a name of My Long order and then the current bar when the order is placed.Code:EnterLong("My Long Order" + CurrentBar);
If we can be of any other assistance please let us know.Cody B.NinjaTrader Customer Service
Comment
-
Hello,
Please see the following example below using ExitLong.
The fromEntrySignalName is a string that you can use to associate a specific exit order with an entry name.Code:ExitLong("My Long Order" + CurrentBar);
If we can be of any other assistance please let us know.Cody B.NinjaTrader Customer Service
Comment
-
Hello,
The fromEntrySignalName would need to be identical to the value that you use in EnterLong().
If you do not it would end up with exiting by submitting long market orders until your position is flat.
I recommend reviewing the Tips subsection for this on ExitLong() in our hlep guide. http://ninjatrader.com/support/helpG...7/exitlong.htm
If we can be of any other assistance please let us know.Cody B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment