Skip to content

Commit 533c711

Browse files
committed
BUG: Only plot trades when some trades are present
Avoids "Trades (0)" legend item.
1 parent 31cff13 commit 533c711

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

backtesting/_plotting.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def plot(*, results: pd.Series,
216216
plot_equity = plot_equity and not trades.empty
217217
plot_return = plot_return and not trades.empty
218218
plot_pl = plot_pl and not trades.empty
219+
plot_trades = plot_trades and not trades.empty
219220
is_datetime_index = isinstance(df.index, pd.DatetimeIndex)
220221

221222
from .lib import OHLCV_AGG

0 commit comments

Comments
 (0)