Please look at this code and tell me what I'm missing. I've isolated the error down to the "MarketOrder" command. This always gives me an error code of "-10" and the order does not execute. I tried varying the order quantity down to 1 contract to eliminate margin issues. And based on 1 discussion I saw that you have to wait one minute on option calls after binding the contract to the symbol. This code does that.

 

Still, no dice.

 

Appreciate any input.