Skip to content

Commit c006fc0

Browse files
committed
REF: Plot Equity and P&L only on condition some trades were made
1 parent 85de9f4 commit c006fc0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

backtesting/_plotting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def plot(*, results: pd.Series,
171171
trades = results['_trades']
172172

173173
plot_volume = plot_volume and not df.Volume.isnull().all()
174+
plot_equity = plot_equity and not trades.empty
175+
plot_pl = plot_pl and not trades.empty
174176
is_datetime_index = df.index.is_all_dates
175177

176178
from .lib import OHLCV_AGG

0 commit comments

Comments
 (0)