Does IB's TWS have a feature that allows you to go flat at the end of day with one click in all markets (futures, stocks, forex, etc)? Thx
you can close all positions, but I am not aware of being able to trigger it to a certain time... you could do this in tradelink for your IB account like so : Code: using TradeLink.API; using TradeLink.Common; using System.ComponentModel; public class FlatClose : ResponseTemplate { PositionTracker _pt = new PositionTracker(); List<string> _syms = new List<string>(); override void GotPosition(Position p) { _pt.Adjust(p); _syms.Add(p.Symbol); sendbasket(_syms.ToArray()); } override void GotFill(Trade fill) { _pt.Adjust(fill); } int SHUTTIME = 155000; [Description("shut down at this time")] public int ShutTime { get { return SHUTTIME; } set { SHUTTIME = value; } } override void GotTick(Tick k) { if (!isValid) return; if (k.time>ShutTime) { isValid = false; foreach (Position p in _pt) sendorder(new MarketOrderFlat(p)); D("auto shutdown"); } } public FlatClose() { // prompt user to change shutdown time when response started ParamPrompt.Popup(this); } } Then when you loaded this strategy in ASP, it would prompt you for a shutdown time and shutdown any positions present at that time. http://tradelink.googlecode.com
Chart Trader has the "close position" button, but that's only for one product. Might still be useful. I don't know the real answer to your question though.
On the Order menu in TWS there is a "Close All Positions" item which I believe should allow you to close everything manually with just a few clicks. Or you could assign it to a hotkey(?). I've never used it however...