Clear Filters
Clear Filters

Matlab 2018 IB TWS Sending Market Order Failure : cannot find method 'placeOrderEx' for class 'COM.TWS_TwsCtrl'

1 view (last 30 days)
Hi guys,
I am trying to send market order to purchase 1 ES contract, using Trading Tool box command, and encountered error message : cannot find method 'placeOrderEx' for class 'COM.TWS_TwsCtrl',
I'm using Matlab 2018a, the code can connect to TWS, any body has seen this before ?
ib = ibtws('',7496);
pause(0.2)
ibContract = ib.Handle.createContract;
ibContract.symbol = 'ES'; % 'SPXL';
ibContract.secType = 'FUT'; % 'STK';
ibContract.exchange = 'GLOBEX'; % 'SMART'; 'GLOBEX'; 'ECBOT' for YM contract
ibContract.currency = 'USD'; % 'USD';
ibContract.LastTradeDateOrContractMonth = '201903';
ibMktOrder = ib.Handle.createOrder;
ibMktOrder.action = 'BUY'; % 'BUY';
ibMktOrder.totalQuantity = 1; % 100;
ibMktOrder.orderType = 'MKT'; % 'MKT' or 'LMT'
%%% Send Order
id = orderid(ib);
result_send_order = createOrder(ib,ibContract,ibMktOrder,id);
Best regards
Terry

Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!