Replies: 1 comment
|
My understanding is that Once you pass explicit long and short signal arrays, such as:
you are already telling vectorbt which signals are long-side and which signals are short-side. In that case I would not expect For a short-only run, I would do one of these instead: pf = vbt.Portfolio.from_signals(
close,
entries=False, # or an all-False array aligned to close
exits=False,
short_entries=prices['short_entry'].astype(bool),
short_exits=prices['short_exit'].astype(bool),
)or pre-mask the long signals yourself: long_entries = prices['long_entry'].astype(bool) & allow_longs
long_exits = prices['long_exit'].astype(bool) & allow_longs
short_entries = prices['short_entry'].astype(bool) & allow_shorts
short_exits = prices['short_exit'].astype(bool) & allow_shortswith So the practical rule is: if you want to switch between long-only and short-only experiments, either pass only the relevant side's signals, or mask the unwanted side to all False before calling |
Uh oh!
There was an error while loading. Please reload this page.
wrestling a bit controlling long vs short positions; i'm passing both long_entry/exit and short_entry/exit signals but then attempting to limit positions simply with 'direction' argument which doesn't appear to be controlling.
When direction=shortonly, i'm getting both long and short positions executed, and vice-versa. I know I'd typically run this with direction=both, but was testing my configuration. Is there something else I should be setting to control bi-directional trade?
All reactions