what if my GAT is, say 1500, and i don't know if i'll have a long or short position at that time. how can i set it up to just close the position (i.e., buy if short, sell if long). i can't make the entry order and OCA order.
I'll try my best - hope the solution is suited to your trading style - you will submit two GAT MARKET orders one to sell and one to buy. Then in the OCA group field of the MARKET BUY order you would put the code IBUYC (Initial Buy Cancel - you can use any code) and the same code in your initial BUY order. Then in the OCA group field of the MARKET SELL order you would put ISELLC (initial Sell Cancel - again you can use your own code) and the same code in your initial SELL order. Is that clear?
Even easier - If you have a LMT BUY order say at 1470 and you want to get out by 15:00 then put in a MARKET SELL order with the GAT field set to 15:00 and conditional on the ES <= 1470. That way the MARKET SELL (at CLOSE) order will only be submitted once your initial BUY order has been executed. Same with an initial SELL order.
fielman, i don't know if i'll need to buy or sell at the GAT. i just want to close all open positions. Example: at 900, i turn on an automated strategy. i leave my computer. this automated strategy can be long or short at various times of the day. at 1500, i'm not back yet, but i just want to close all open orders. i will not know at 900 whether i'll be long or short at 1500. i don't think your instructions can handle this, can it?
No, sorry it can't handle it if you do multiple trades during the day. You will have to program the API to do that. A simple strategy with either a BUY or SELL during the day (or no trade at all) can use the method i described. Otherwise the AMRKET ORDERS will sell and buy from each other at the end of the day - you do not want that :eek:
i know that would seem logical, but say you are in a situation where you want to close the position when the market closes. in this case, the order from the automated strategy is sent too late because it will wait until the bar to close before sending the order. i want to sent it maybe 10 seconds before the market closes. that's why i want to use GAT. any ideas?
1. Modify your automated program to send a closing market order at a certain specific time, not when the bar closes. OR maybe better 2. Have your automated program monitor your fills. As soon as a position is filled, have your automated program enter via API a GAT closing market order for that position, valid 10 seconds before the market close. I'm assuming you can enter GAT orders via API, which may not be the case.