if (State == State.Configure)
{
SetStopLoss(CalculationMode.Ticks, 30);
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
SetStopLoss method does not update quantity upon partial position close
Collapse
X
-
SetStopLoss method does not update quantity upon partial position close
SetStopLoss method does not update quantity upon partial position close. Suppose I've filled a position of 4 contracts and SL is on 4 contracts alright. At at point, I decided to close 2 contracts but this does not update SL quantity automatically. Any help to fix this would be nice. Thanks.
Code:Tags: None
-
Hello singjay,
Thank you for your post.
Are you closing the 2 contracts manually or programmatically? I see you are calling SetStopLoss() without using a fromEntrySignal name. This means the exit order will be attached to all entries and the quantity should match the quantity for the Position object in NinjaScript:
If you are manually closing 2 contracts, this would not necessarily update the position object in the strategy and could be the reason you are not seeing the stop loss quantity change. If you would like to manually modify stops and targets, I suggest using ATM strategies in your NinjaScript strategy logic. This allows you to set programmatic entries, then manually manipulate the entry/stop/target orders as desired. For more information:Please let us know if we may be of further assistance.
-
Hello singjay,
Thank you for your reply.
Do you see any errors on the log tab of the Control Center? If so, what do the errors report?
I suggest adding Print() statements as well as enabling Trace Orders to receive valuable information in the NinjaScript Output window to help you better understand your strategy's behavior. For more information on using prints and trace orders, please see the following links:- https://ninjatrader.com/support/foru...ing#post791121
- https://ninjatrader.com/support/help...aceorders2.htm
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 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