Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Default take profit (tp) and stop loss (sl) on Signal Strategy #1167

Unanswered
parthnatekar asked this question in Q&A
Discussion options

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

You must be logged in to vote

Replies: 1 comment

Comment options

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

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /