Is exectype parameter of order_target_* ignored?
If I create stop order using order_target* calls the order is immediately filled even if current security price isn't even close to the order stop price. Is it a bug or I'm missing something?
def order_target_size(self, data=None, target=0, price=None, plimit=None, exectype=None, valid=None, tradeid=0, **kwargs): ... ... return self.buy(data=data, size=target - possize, price=price, plimit=plimit, exectype=exectype, valid=valid, tradeid=tradeid, **kwargs) .... ....
Not it's not being ignored. It is also unknown what you actually do.
You're right. It's not being ignored. It's something else, but I wasn't able to figure that out yet :(
Now I can see the same thing even when I use self.buy(...)
It is also unknown what you actually do.
I'm trying to create stop loss order for short position. Here is my log:
info: 2015-01-27 10:00:00, AAPL: price: 111.1 info: 2015-01-27 10:00:00, short entry order 14, stock = AAPL, size = 958 info: 2015-01-27 10:01:00, AAPL: 14 order executed: price: 111.10, value: -106433.80, commm 0.00, cost basis: 111.10, stock price: 111.02 info: 2015-01-27 10:02:00, AAPL: price: 111.22 info: 2015-01-27 10:02:00, (short position) stop loss order 15, stock = AAPL, entry price = 111.1, stop price = 111.882110705 info: 2015-01-27 10:04:00, AAPL: 15 order executed: price: 111.88, value: -106433.80, commm 0.00, cost basis: 111.10, stock price: 111.05 info: 2015-01-27 10:04:00, Trade value: 0.00, P/L -749.26, P/L comm: -749.26
As you can see my stop loss order gets executed almost immediately, but current stock price 111.05 is far from stop price 111.88
Any idea what could be the reason?
I'm using this code to create the order:
self.buy(data, size=position.size, price=stop_price, exectype=bt.Order.Stop)
figured that out. the stop price was actually triggered. The high for the bar is higher than the stop price. As always, the explanation is simple, but it takes time to find it out :)
Hi. Candyreview last edited by
This post is deleted!