@@ -91,8 +91,8 @@ def I(self, # noqa: E743
9191
9292 In the plot legend, the indicator is labeled with
9393 function name, unless `name` overrides it. If `func` returns
94- multiple arrays, `name` can be a collection of strings, and
95- the size must agree with the number of arrays returned.
94+ multiple arrays, `name` can be a sequence of strings, and
95+ its size must agree with the number of arrays returned.
9696
9797 If `plot` is `True`, the indicator is plotted on the resulting
9898 `backtesting.backtesting.Backtest.plot`.
@@ -130,8 +130,7 @@ def _format_name(name: str) -> str:
130130 elif try_ (lambda : all (isinstance (item , str ) for item in name ), False ):
131131 name = [_format_name (item ) for item in name ]
132132 else :
133- raise TypeError (f'Unexpected `name` type { type (name )} , `str` or `Iterable[str]` '
134- 'was expected.' )
133+ raise TypeError (f'Unexpected `name=` type { type (name )} ; expected `str` or `Sequence[str]`' )
135134
136135 try :
137136 value = func (* args , ** kwargs )
@@ -151,8 +150,8 @@ def _format_name(name: str) -> str:
151150
152151 if isinstance (name , list ) and (value .ndim != 2 or value .shape [0 ] != len (name )):
153152 raise ValueError (
154- f'The number of `name` elements ({ len (name )} ) must agree with the nubmer '
155- f 'of arrays ({ value .shape [0 ]} ) the indicator returns .' )
153+ f'Length of `name=` ({ len (name )} ) must agree with the number '
154+ 'of arrays the indicator returns ({value.shape[0]}).' )
156155
157156 if not is_arraylike or not 1 <= value .ndim <= 2 or value .shape [- 1 ] != len (self ._data .Close ):
158157 raise ValueError (
0 commit comments