We'd need some help in writing in Python a simple Forex/Futures trading strategy (which is simple and already well defined) so that the IB API of Interactive Brokers could automatically send to market buy and sell orders on various currency pairs following a basic set of trading rules to be written as mentioned on Python.
This algorithm takes about 5-6 key inputs, including futures tickers, number of seconds to track (S), number of std dev to trigger or stop a trade, position size (ideally, should have the last inputs as default)
- Needs to connect to an Interactive Brokers (IB) account through API (can use IB Gateway or IB TWS)
- starts tracking real-time data for the futures when turned on or at assume 8am NY time and downloads prices real time keeping track of the few data points,
- next step is to compute moving averages over different horizons (1 week, 1 month, 100day, 200day, 12mth etc) using the 4pm closing data points
- every second it will make a couple of calculations using the MAs or the last few days's pricings on the two pricing arrays including simple math and standard deviations and with the most current data point, a simple calculation will trigger a Short/Long trade
- when there is a Short/Long new position triggered, it needs to place that order for IB to execute immediately. There should be a switch using which user can decide if trades are meant to be automatically executed or just sent as limit orders.
- Strong checks need to be built to ensure in case of software or market data errors multiple orders are not sent causing unwanted trades
- once trades are done there should be a mechanism to track the trade wise P&L and portfolio P&L for a take profit or stop loss level