Negative OrderLimit for selling options

Posted By: jbhunter

Negative OrderLimit for selling options - 12/27/20 23:01

How might one put in a limit order in IB if you are selling options and receiving premium?

It appears that TWS is looking for a negative value for the Limit. When I use OrderLimit=3.87, you get a pending order like the picture below. When using OrderLimit=-3.87 (negative) then the order is put in as a Market order.

[img]https://ibb.co/rHdsBh9[/img]
[img]https://ibb.co/wcJYcrH[/img]


Code
	
var p = priceClose();
printf("\nAsset=%s, priceClose=%.2f",s,p);
int num = contractUpdate(Asset,0,PUT|CALL);
printf("\nAsset=%s, contractsFound=%i",Asset,num);

CONTRACT* put = contractFind(PUT,1,p,6);
CONTRACT* call = contract(CALL,put->Expiry,put->fStrike);
contractPrint(put, TO_WINDOW);
contractPrint(call, TO_WINDOW);

var putPrice = contractPrice(put);
var callPrice = contractPrice(call);

printf("\nputPrice=%.2f  callPrice=%.2f",putPrice,callPrice);

var putMid = 0.5*(put->fBid+put->fAsk);
var callMid = 0.5*(call->fBid+call->fAsk);

printf("\n%s, putMid=%.2f, callMid=%.2f, straddleMid=%.2f",Asset,putMid,callMid,putMid+callMid);

int pos = -1;
CONTRACT* straddle = combo(put,pos,call,pos,0,0,0,0);


OrderLimit = round_to(putMid+callMid,2);
printf("\nOrderLimit=%.2f",OrderLimit);
//contractPrint(straddle,TO_WINDOW);
enterLong(comboLeg(1));
enterLong(comboLeg(2));


Asset=NIO, priceClose=47.01
!Get Option Chain NIO-OPT--0.00--SMART/ISLAND--USD
Asset=NIO, contractsFound=1178
NIO,Put,20201231,47.0000,0.0000,1.8900,1.8900,100,0,NIO-OPT-20201231-47.00-P-SMART
NIO,Call,20201231,47.0000,0.0000,1.9800,1.9800,100,0,NIO-OPT-20201231-47.00-C-SMART
putPrice=1.89 callPrice=1.98
NIO, putMid=1.89, callMid=1.98, straddleMid=3.87
OrderLimit=3.87
[NIO::SP02712] Place 1 Put 20201231 47.00 100@1.89
!Order Message:
BUY 1 Combo
Warning: your order will not be placed at the exchange until 2020-12-28 09:30:00 US/Eastern NIO-BAG--0.00--SMART/--USD
Posted By: strimp099

Re: Negative OrderLimit for selling options - 02/21/21 01:33

IB tracks at the position level. So what you’re seeing in the IB chart is your combined position which is not any sort of exchange price. If you enter a buy limit for a short spread that’s saying that you will buy the position back at that price which generates a debit (a positive number). If you enter a negative value that tells IB you want to open a credit spread (a negative number) which would get you shorter your straddle. The chart is misleading because it just prints the position price. A stop loss would be a debit that’s greater than the credit you received. For example you enter a stop loss at 5. That means that volatility has increased and its now more expensive. The net trade would be -3.87+5=1.13 debit or loss on the trade.

In my experience this gets a bit counterintuitive especially when your spread goes OTM. One way to get a feel for this is to trade manually in your IB demo account.
© 2024 lite-C Forums