I am using below code for sending orders TWS;
if( LastValue( Buy ) )
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() )
// check if we do not have already open position on this stock
if( ibc.GetPositionSize( Name() ) == 0 )
// transmit order
ibc.PlaceOrder( Name(), "Buy", quantity , "MKT", 0, 0, "Day", True);
this works if quantity is explicitly declared as a number. But I want to use variable quantity, like what is derived from below formula. Could you pls advice where am I going wrong?
Moderator comment: You have ignored forum rules and posted without reading “How to use this site” and withotu using proper CODE TAGS and I had to fix your post. If you do this next time your post will be deleted for not following forum rules.