Does Jesse support trailing stop-loss or some kind of break-even functionality?

Yes. Although not directly.

Jesse doesn't allow to submit orders directly, instead, it uses a smart ordering system. You tell it at which price you want to buy or sell and behind the scenes (by comparing that price to the current price) it will choose the correct order type for you. It uses market, stop, or limit orders.

To implement a semi-trailing stop loss or break-even order, you can use the update_position() method.

Example

Below example says if the current position is in more than 2% profit, set a closing stop loss at entry price of the position (break-even):

def update_position(self):
    if self.position.pnl_percentage > 2:
        self.stop_loss = self.position.qty, self.position.entry_price
Last updated: 3 years ago