Open Order's side as a Factor on the Strategy condition
Vasco Laranjo last edited by Vasco Laranjo
I was wondering how can I obtain the open/current of an open order, so that then I can use it as a condition on the strategy?
This is different than the position, since what I'm interested in is current side: long/short. This matters on the signal construction, for instance on the below I would like to apply it only if "and current position is short (sell side)".
if self.position: if self.pct_change > abs(self.params.pctlimit) and _____________: self.log('CLOSE SELL, %.2f' % self.dataclose) self.order = self.close()
open/current of an open order,
Sorry you are obviously not looking for what open orders have.
for instance on the below I would like to apply it only if "and current position is short (sell side)".
You are looking for the actual position. Use the
sizeof the position (which is being tested as a boolean but has a sign and is used in several samples)