-
-
Notifications
You must be signed in to change notification settings - Fork 823
Description
When using vectorbt.Portfolio.from_signals with both long and short entries, and providing sl_stop/tp_stop as fixed tick distances, only short trades are executed. All long entry signals are ignored, despite being correctly timed and having valid sizes.
portfolio = vbt.Portfolio.from_signals(
close=df_tick['open'],
entries=tick_entries_long,
exits=forced_exits,
short_entries=tick_entries_short,
short_exits=forced_short_exits,
size=entry_size, # all positive
sl_stop=sl_stop, # fixed tick distance, e.g. 20
tp_stop=tp_stop, # same
size_type='amount',
init_cash=50000,
accumulate=False,
allow_partial=False,
freq='1ms'
)
Observed Behavior
tick_entries_long contains valid signals.
entry_size is non-zero for long signals.
No long trades appear in the portfolio.
All executed trades are short.
No errors, warnings, or rejections.
Suspected Cause
The documentation says sl_stop and tp_stop should be in percentage terms:
"in percentage of the price below the acquisition price"
If I pass values like 20 (expecting ticks), it might be interpreted as -1900% of price for long trades—resulting in invalid stop-loss levels, causing trades to be silently skipped.
Questions
Should sl_stop and tp_stop always be expressed as percentages of the entry price?
If yes, can this be clarified more explicitly in the docs?
Why are invalid long trades not generating rejections or warnings?