PegMkt Order Type


#1

Does anyone know where the ‘offset’ would go in a PegMkt order type? It looks like you need to pass through both a limit price and an offset to use the PegMkt…

Does anyone have any experience using IB’s other Algo order types?


#3

See this:
http://xavierib.github.io/twsapidocs/basic_orders.html

I did not check this but according to docs you just place offset in AuxPrice field of the order structure. To do so from ibc.PlaceOrder call just use StopPrice argument (it is just AuxPrice in TWS API):

http://www.amibroker.com/at/

PlaceOrder( string Ticker, string Action, number Quantity, string Type, 
number LimitPrice /* here comes your limit */, 
number StopPrice /* here comes your offset */, 
string TimeInForce, bool Transmit, [optional] number TickSize = 100, [optional] string Attributes = "", [optional] string ParentID = "", [optional] string OCAGroup, [optional] number OCAType, [optional] string FAParams, [optional] string Account)

So Limit Price goes to LimitPrice argument and Offset goes to StopPrice.


#4

Tomasz,

I have been trying to get working what you have suggested in this post and have not been successful.

It looks like the StopPrice is defaulting to 0.01 on REL orders (and I believe for Pegged Market Orders as well), even though a PlaceOrder call is being sent with a value other than 0.01. This becomes extremely important with the SEC TickSize Pilot program and stocks that trade in 5 cent increments as all REL orders are being rejected on these symbols according to IB “rules” (link).

I’m attaching a couple of screenshots from IBController as well as the Amibroker TRACE window. I am getting the OrderID value back from the PlaceOrder call without an error and printing out the value in the TRACE window. However, if you match up the OID in the Trace window with the OID in the IBController, you can see that the values for StopPrice are different.

Below is a code snippet for the logic I am using to send the REL order:

current_time = Now(4);
TimeInForceString = TimeInForce(current_time,0,4,0);
Ask = GetRTData("Ask");
offset = 0.05; // actual offset logic omitted but something other than 0.01 will do for testing
limit_price  = Ask + offset;
stop_price = offset;
oid = ibc.PlaceOrder(symbol, "BUY", quantity, "REL", limit_price, stop_price, TimeInForceString, True );
_TRACE("ORDER ID: " + oid + ", Symbol: " + symbol + ", Quantity: " + quantity + ", Limit: " + limit_price + ", Stop: " + stop_price);

Please let me know if you see anything I am doing here which is incorrect.

Thanks,
David

IBController


#5

New users can only put one image … here is the TRACE window

AmibrokerTrace


#6

@Tomasz
It has been a couple of weeks since I posted this … was just wondering if there might be any advice/suggestions/recommendations regarding the behavior I am seeing with the REL and PEGMKT orders and the offset/StopPrice discrepancy.


#7

@Tomasz

I’m curious too on this issue…