diff --git a/backtesting/_plotting.py b/backtesting/_plotting.py index 5c1a2d67..368b14f6 100644 --- a/backtesting/_plotting.py +++ b/backtesting/_plotting.py @@ -569,7 +569,8 @@ def __eq__(self, other): if is_overlay: ohlc_tooltips.append((indicator_name, NBSP.join(tooltips))) else: - set_tooltips(fig, [(indicator_name, NBSP.join(tooltips))], vline=True, renderers=[r]) + set_tooltips(fig, [(indicator_name, NBSP.join(tooltips))], + vline=True, renderers=[r]) # If the sole indicator line on this figure, # have the legend only contain text without the glyph if len(value) == 1: diff --git a/backtesting/test/_test.py b/backtesting/test/_test.py index 3d2757d3..82ce1acf 100644 --- a/backtesting/test/_test.py +++ b/backtesting/test/_test.py @@ -774,9 +774,9 @@ def next(self): def test_indicator_legends(self): class S(Strategy): def init(self): - self.I(lambda:(SMA(self.data.Close, 5),SMA(self.data.Close, 10)), overlay=True, - scatter=False, legends=['SMA 5','SMA 10']) - + self.I(lambda: (SMA(self.data.Close, 5), SMA(self.data.Close, 10)), overlay=False, + name='Simple Moving Averages', scatter=False, legends=['SMA 5','SMA 10']) + def next(self): pass