We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am new to your package and was hoping you might answer a general setup question:
Can you provide a quick example of how to add the stop loss logic to an existing strategy of the form :
fast_ma, slow_ma = vbt.MA.run_combs(price, window=windows, r=2, short_names=['fast', 'slow']) entries = fast_ma.ma_above(slow_ma, crossed=True) exits = fast_ma.ma_below(slow_ma, crossed=True)
[STOP LOSS logic here]
Such that the stop loss and normal exit logic integrate together
The text was updated successfully, but these errors were encountered:
You can generate stop signals, combine with your exit signals using OR rule, and select the first exit after each entry.
stop_exits = entries.vbt.signals.generate_stop_exits(price, -0.1) exits = (exits.vbt | stop_exits).vbt.signals.first(reset_by=entries, allow_gaps=True)
Actually if you are using Portfolio.from_signals, you don't need the last step since only the first signal is executed anyway.
Portfolio.from_signals
Sorry, something went wrong.
No branches or pull requests
I am new to your package and was hoping you might answer a general setup question:
Can you provide a quick example of how to add the stop loss logic to an existing strategy of the form :
fast_ma, slow_ma = vbt.MA.run_combs(price, window=windows, r=2, short_names=['fast', 'slow'])
entries = fast_ma.ma_above(slow_ma, crossed=True)
exits = fast_ma.ma_below(slow_ma, crossed=True)
[STOP LOSS logic here]
Such that the stop loss and normal exit logic integrate together
The text was updated successfully, but these errors were encountered: