I used a testing code to buy 2 ER2 contracts with a stop loss order sent out along with the "Buy MKT" order. What I do not understand is that why it took 3 seconds for TWS to accept the stop loss order. A screenshot image is attached. The code which submitted the orders is as follows.
function sendSellMktWithBuyStopOrder(symbol, size, stop)
{
var size_ = size;
if ( symbol.indexOf("ES ") == 0 || symbol.indexOf("AB ") == 0 || symbol.indexOf("NQ ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
sellMarket(symbol, size_, "GLOBEX", indexFuturesExpirationDate);
buyStop(symbol, size_, stop, "GLOBEX", indexFuturesExpirationDate);
}
}
else if ( symbol.indexOf("YM ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
sellMarket(symbol, size_, "ECBOT", indexFuturesExpirationDate);
buyStop(symbol, size_, stop, "ECBOT", indexFuturesExpirationDate);
}
}
else if ( symbol.indexOf("SPY") == 0 || symbol.indexOf("DIA") == 0 || symbol.indexOf("QQQQ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
if ( size_ < 10 ) size_ = 100 * size_;
sellMarket(symbol, size_);
buyStop(symbol, size_, stop);
}
}
}
The stop order is almost sent out at the same time as the buy mrk order. Why in the broker window in eSignal the buy mrk order was filled at 3:51:01pm while the stop loss order was timestamped at 3:51:04pm (PendingSubmit status). I think 3:31:04PM was the time the stop order accepted by TWS.
My question is that what is the reason causing the three second delays between two orders.
- Clearpicks
function sendSellMktWithBuyStopOrder(symbol, size, stop)
{
var size_ = size;
if ( symbol.indexOf("ES ") == 0 || symbol.indexOf("AB ") == 0 || symbol.indexOf("NQ ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
sellMarket(symbol, size_, "GLOBEX", indexFuturesExpirationDate);
buyStop(symbol, size_, stop, "GLOBEX", indexFuturesExpirationDate);
}
}
else if ( symbol.indexOf("YM ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
sellMarket(symbol, size_, "ECBOT", indexFuturesExpirationDate);
buyStop(symbol, size_, stop, "ECBOT", indexFuturesExpirationDate);
}
}
else if ( symbol.indexOf("SPY") == 0 || symbol.indexOf("DIA") == 0 || symbol.indexOf("QQQQ") == 0 ) {
if ( size_ > 0 && stop > 0 ) {
if ( size_ < 10 ) size_ = 100 * size_;
sellMarket(symbol, size_);
buyStop(symbol, size_, stop);
}
}
}
The stop order is almost sent out at the same time as the buy mrk order. Why in the broker window in eSignal the buy mrk order was filled at 3:51:01pm while the stop loss order was timestamped at 3:51:04pm (PendingSubmit status). I think 3:31:04PM was the time the stop order accepted by TWS.
My question is that what is the reason causing the three second delays between two orders.
- Clearpicks
Comment