Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific values for stop loss BUT DIFFERENT FOR LONG/SHORT STOP #741

Open
Headloss opened this issue Aug 12, 2024 Discussed in #338 · 0 comments
Open

Specific values for stop loss BUT DIFFERENT FOR LONG/SHORT STOP #741

Headloss opened this issue Aug 12, 2024 Discussed in #338 · 0 comments

Comments

@Headloss
Copy link

  1. How does it work for strategies with fixed long and stop prices at same time? I imagine it could only be the same percents not separate ones for long and short.
  2. Are the sl_stop percents only a signal or a "ffill_ed" stops persisting from the signals? I assume it should be the latter.
  3. Could one add a fixed stop to exit as a signal, to solve problem 1 if problem 2 statement is a "one-time signal"?

 

Discussed in #338

Originally posted by ironstone05 January 18, 2022
Hi, I have just started with algo trading and use this library to backtest my strategies. Its really great. However, I am having trouble with one specific thing.
I am trying to set the stop loss (and profit) to an exact value instead of a percentage. For eg., for the particular scalping strategy I am testing, I want to set the stoploss to the low of the previous candle and take profit at 1.5 times the risk. Since the margins are low, I want to have better control over the stop loss. Is there a way to set it in such a manner? I went through the documentation and think that either the adjust_sl_func_nb or the stop_exit_price functions are to be used maybe. However, I am unsure on the implementation. It would be great if I could get some help.
Currently, this is the code I am using to backtest:
pf = vbt.Portfolio.from_signals(price, entries, sl_stop= 0.0001, tp_stop= 0.0002, init_cash=10000)

Thanks a lot and kudos on this wonderful implementation! The feature set is so very deep and I am sure I have a long way to go before I understand everything about the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant