This is the code I'm playing with:
def next(self): if not self.position: # not in the market if self.crossover > 0: # if fast crosses slow to the upside self.buy() # enter long elif self.crossover < 0: # in the market & cross to the downside self.close() # close long position
It enters a long position on SMA crossover and closes it out if we cross under.
I'd like to modify so that once I enter a position, it automatically creates a limit close order at say, +25% of the fill price.
So after self.buy() at a crossover at $100 a share, for example. I want immediately to submit a limit close for $125 to be executed if/when the price reaches that point.
Any feedback would be appreciated, I'm awful at python but working hard at being less so, but the existing documentation isnt sinking in for me yet.