TIF (Tag 59) is used to indicate how long an order will remain active before it is executed or expires. It allows traders to be more specific about the time parameters in which an order is activated. This is especially important for active traders.
Time-in-force options will depend on your broker, as to what all TIF they support on their side.
FOK : 59=4 (FILL OR KILL)
execute a transaction immediately and completely or not at all. It is most likely used by active traders and is usually for a large quantity of stocks. The order must be filled in its entirety or canceled (killed). Its purpose is to ensure that a position is entered at a desired price.
IOC : 59=3 (Immediate Or Cancel)
requires All or A part of the order to be executed immediately otherwise, the order (or any unfilled parts of the order) will be canceled.
GTC : 59=1 (Good Till Canceled)
An order to buy or sell that remains in effect until it is either executed or canceled; sometimes called an "open order". In most cases, GTC orders are canceled by brokerage firms after 30-90 days. This type of order is traditionally placed at price points away from the price of the stock at the time theorder is placed. For example if a stock you hold is currently $40 but you believe it will go to $50 at which point you will sell then, you can use a GTC order. Once the GTC order to sell is placed, if the price of the stock reaches $50 at any point over the next few months your shares will be sold.
GTD : 59=6 (Good Til Date)
Order remains active until a user-specified date in (tag 126 Expire time), unless it has been filled or canceled.