- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 1.3k
Default take profit (tp) and stop loss (sl) on Signal Strategy #1167
-
Hi,
I'm not sure where the default take profit (tp) and stop loss (sl) are being set for the SignalStrategy example shown in the tutorial. Can someone please help.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
You can set stop-loss and/or take profit values when calling strategy.buy or strategy.sell or self.buy or self.sell.
You may benefit from exploring my case of updating stop-losses dynamically.
This - https://github.com/s-kust/python-backtesting-template/blob/main/strategy/run_backtest_for_ticker.py - is the main Strategy template.
See also update_stop_losses function here - https://github.com/s-kust/python-backtesting-template/blob/main/utils/strategy_exec/stop_loss.py 
Beta Was this translation helpful? Give feedback.