Does anyone know how to set Hotkeys or Hot buttons to place an order with a size based on the position. As an example: I'm in a long position of 1500 shares of XYZ and want to take a partial at the market - p.e. 25%/375sh. Since I vary the size according to the risk of each trade, the solution I found was to create an array of Hotkeys/Hotbuttons, which I see as unpractical. Is there anyway to program (via API) hotkeys? Can anyone share an example script that bases the order size on the open position? Thanks
I don't think that the API can program hotkeys or otherwise modify functionality of TWS. The API is meant to request and receive information directly from IB's servers, or to send trade instructions (buy/sell) to IB's servers. What might be a possibility is that you use an API program which bypasses TWS. For example: you look at the TWS chart and then use a key for your API program to send a buy/sell order directly to IB. Your program would thus need a user interface to your liking and with the buttons you need. The resulting order line and trade will become visible to you in TWS. I don't have an example of such a program available though.
Hi patan, To my knowledge there are a few 3rd party software to integrate with IB, as DAS, Ninja Trader, Kinetic and IQFeed (all payed). I didn't tried any so I can't give a recommendation.