Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Flatten Position
Collapse
X
-
In the first filled I only submit stop1 and stop2 because the position quantity is only 3. So I submitted 2 for stop1 and 1 for stop2. Now seconds later the market filled the remaining 2 contracts. So as I said in my stop management I have this setup stop1 = 2, stop2 = 2, and stop3 = 1, that makes 5 contracts. My question is how to amend the quantity of my submitted stop2? Because I only submit 1 on it on the first filled. So that I could still maintain my stop management setup. I could not submit stop3 with the remaining 2 contracts filled because it will not follow my stop management setup.
-
-
Hi edward_bell,
You are correct.
Because the quantity is changing you will need to use change order.
http://www.ninjatrader.com/support/h...hangeorder.htm
Let me know if you have any trouble using this.Chelsea B.NinjaTrader Customer Service
Comment
-
What if filled price of the 2 remaining contracts is different by a tick from the filled price of the 3 contracts?
Comment
-
Hello edward_bell,
That can and does happen.
NinjaTrader provides a Position.AvgPrice. This would be the average entry point.
Lets say you enter two orders. One fills at 100. The other fills at 120. NinjaTrader would then give a Position.AvgPrice of 110.
Below is a link to the help guide on Position.AvgPrice.
http://www.ninjatrader.com/support/h...7/avgprice.htmChelsea B.NinjaTrader Customer Service
Comment
-
So in my previous case what will happen to my stop2? I could not amend it because it has different filled price.
Comment
-
Originally posted by edward_bell View PostSo in my previous case what will happen to my stop2? I could not amend it because it has different filled price.
The fill price of an order has nothing to do with the Stop price of the protective order. If you want to use the fill price to calculate the stop price, then just use it. The price at which you issue the stop is the price at which you issue the stop, whether initially, or as adjusted.
Comment
-
Hello edward_bell,
Are you not able to amend the order using ChangeOrder?
I am currently using the following line to amend stop1 to 5 ticks below entry successfully.
ChangeOrder(stop1, 1, 0, Position.AvgPrice - 5 * TickSize);
Attached is the full code.Attached FilesChelsea B.NinjaTrader Customer Service
Comment
-
SubmitOrder Using "Buy" vs "BuyToCover"
Hi ChelseaB,
I notice in all your attached examples using Unmanaged mode, you have this code,
When you are short, shouldn't you use OrderAction.BuyToCover?Code:else if (Position.MarketPosition == MarketPosition.Short) { SubmitOrder(0, OrderAction.Buy, OrderType.Market, Position.Quantity, 0, 0, "", "exit"); }
I presume they both end up doing the same thing because of OrderType.Market, but,
wait, uh ... hmm, aren't they both going to do exactly the same thing all the time for
all order types?
So, what's the difference in behavior between using "Buy" and "BuyToCover"?
Does it depend upon the exchange or something?
Thanks
Comment
-
Edward, maybe this is too late, but in case it can be helpful for you, I'd suggest to set your stops-orders from other method:
Code:protected override void OnPositionUpdate(IPosition position) { // detects what the new position is // If new position cancel old stops order and submit the one accordingly // if it's till same position with different quantity: change the order accordingly }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
77 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
45 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
27 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
32 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
62 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment