How data parameter in buy, sell and close work?
I am trying to understand how data parameter in buy, sell and close work. According to the docs
data (default: None) For which data the order has to be created. If None then the first data in the system, self.datas or self.data0 (aka self.data) will be used
I assumed that when we initiate
self.close()bactrader uses the close price as the default point of entry. But when I did something like this
it is throwing error. So how does data parameter in buy, sell and close work?
datais the target and NOT a price. The doc says that the argument
priceis where you put the price. Although for some orders, there is more than once price.
You probably want to read about the execution types, to understand when you can and you cannot determine the price.