View Full Version : Which contracts get sold first?
nepenthean
11-15-2010, 08:22 PM
Hello.
If I buy a contract on Monday and then another on Tuesday, then sell one on Wednesday, which contract gets sold? Is it first in first out?
Thanks
NinjaTrader_Chip
11-15-2010, 08:24 PM
Hello nepenthean,
Thank you for your post.
Please check out the following on FIFO Optimization
All order entry interfaces preserve FIFO (First In First Out) status with the exchanges when possible.
Why is this important?
This is important since getting filled on your orders is dependent on a FIFO algorithm which basically means orders submitted ahead of yours at your order's price level will get filled ahead of you. Think of it like a long line up at the grocery store. You are checked out only when those in line ahead of you have been checked out. NinjaTrader preserves your place in line when possible giving you the best possible advantage of getting your orders filled.
So what exactly is NinjaTrader doing?
Both order entry interfaces simplify the visualization of orders. Let's say that you have a buy limit order for 1 contract. You now want to modify this order from 1 contract to 2 contracts. Most other programs will simply change this order directly. In behind the scenes (at the broker's order servers) what is really happening is that the original order is canceled (removed from the line) and then a new order for 2 contracts is submitted which then goes to the back of the line putting you at a disadvantage. Imagine waiting in the grocery store checkout line for ten minutes. You forgot to get some bread, you leave the line in order to get the bread that you wanted (changing your order) and upon your return to the check out line, you have to start at the back of the line and wait all over again! With NinjaTrader, when you modify the order from 1 contracts to 2 contracts, an additional order for 1 contract is submitted. Now you have the original order for 1 contract waiting in the middle of the line somewhere and the new order for 1 contract at the back of the line. Your original order is not penalized and you maintain your position in line. The opposite is true for decreasing an order size. Although there are two working orders NinjaTrader consolidates the display so it looks as if there is only one order working. You decide to decrease the order size from 2 contracts back to 1. NinjaTrader will modify the newest orders first and the oldest orders last in order to preserve your FIFO status. Following our example, the second order that was placed would be canceled and you would be left with the original order for 1 contract with its maintained position in the order queue.
Please let me know if you have any additional questions.
nepenthean
11-15-2010, 09:41 PM
Chip,
What I mean is, let us say I buy an SI contract for 25.50, and then I buy another at 25.75. The price rises to 26.00, and I sell one contract. Which contract is sold? The one I bought at 25.50 or the one at 25.75?
Thanks
NinjaTrader_Chip
11-15-2010, 11:27 PM
Hello nepenthean,
Your first purchase price was 25.50 so that is the one the P&L would be booked against.
randysiems
11-27-2010, 04:39 PM
NT-Chip, it is possible to turn off the FIFO function? Suppose I purchase contract #1 and #2 on Monday and I decide to sell contract #2 on Thursday and contract #1 on Friday. Is this possible?
nepenthean
11-27-2010, 05:02 PM
That is a good question. Perhaps I want to hold a core position but also take intra-day trades. What Randy is saying would help.
Thanks
NinjaTrader_Chip
11-28-2010, 02:28 PM
Hello randysiems & nepenthean,
All order entry interfaces in NinjaTrader preserve FIFO (First In First Out) status with the exchanges when possible. This is not a setting that can be turned off.
randysiems
11-28-2010, 03:00 PM
What would be suggested for a "Core Holding" position while trading that same core holding. In other words what is the work around for the FIFO. Example using the same instrument, how is it possible with NT to enter trade #1 then #2 then #3 then exit trade #2 only. Still holding trade #1 and #3? This is crucial in some forms of trade management.
NinjaTrader_Chip
11-28-2010, 05:19 PM
Hello randysiems,
If you need to execute against a specific entry then you would contact the broker and provide them with the Order ID (or similar unique identifier). This information is available in the Executions tab of the NinjaTrader Control Center.