private void OnButtonClickAddStoploss(object sender, RoutedEventArgs rea)
{
System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
TriggerCustomEvent(o =>
{
EnterShortStopLimit(BarsInProgress, true, _posSize, Low[1] - (10 * TickSize), Low[1] - (10 * TickSize), ShortPos);
}, null);
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Add stoploss to open position in strategy
Collapse
X
-
Add stoploss to open position in strategy
In my strategy, I've coded custom buttons to open long/short positions successfully. I need help to add stop-loss to an open position with a button click. I've tried using EnterLongStopLimit and EnterShortStopLimit functions with no luck. Please help. Trying to add the normal stop-loss that I can drag up/down as needed that's withing the strategy scope. Thanks.
Code:Last edited by singjay; 10-05-2023, 10:52 AM.Tags: None
-
Hello singjay,
When you say that you had no luck what specifically was the problem?
Using a live until cancelled order like you have would be the correct way to submit targets after an entry had already made a position. You would need to make sure the signal name you are using is the same signal name that you gave to the entry order.
-
Hello singjay,
That means you are trying to use an invalid price for that type of order, the price you used was on the wrong side of the current market price. You need to change the price that you are using to be on the correct side of the market. The easiest way to make sure you have the right type of order for a position is to use the chart trader and manually enter a position and then right click on the chart. The right click menu will show you the types of orders that can be submitted based on where the mouse is in relation to the price.
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