That is do-able but is a bad idea. IB has a few vb examples on their website. If you want semi-automation for discretionary trading I would pay a small monthly fee to use ButtonTrader. It was simply the best and far better than anything I could code. They keep up with changes to the API and I found them to be friendly and responsive. They don't get much press here on ET but it is an awesome discretionary front-end.