Bar graphs and oscillator support
First of all, thank you for this project it is very well done.
This is a feature request to add support for bar graphs in addition to the current line and scatter plots.
Oscillators might also benefit from an alternative style with an area colouring like so:

And having two lines together in one graph:

And having two lines together in one graph
Indicator function can return multiple (i.e. a tuple of) arrays. This works.
self.I(lambda: (ta.SMA(close, self.slow),
ta.SMA(close, self.fast))
Area chart is meh, because that also needs a defined center/min. Bar chart would be near trivial to implement, but I don't see much informative difference in bars vs. a line. This is not TradingView. :stuck_out_tongue_winking_eye:
The lambda trick is cool, how would you pass something like a different color/name to each one?
My argument in favour of something like bars (or more visual styles in general) is that it would be visually distinct, I realise it's not TrardingView heh. The only other way on a busy chart is to have a lot of color variations and that has its own downsides.
how would you pass something like a different color/name to each one?
Something like this should work:
self.I(..., color=('pink', 'lime'))
but that was apparently lost in https://github.com/kernc/backtesting.py/commit/bae9340aaef4d5f407bec18daae22f74a98d4f13 (restored in https://github.com/kernc/backtesting.py/commit/c37e7a98546d58ead428b740eba789fa1c77e2f8, master). Default colors should be distinct, cycled from the colorgen.
That was the first thing I tried, thanks for patching. It's actually color singular not colors plural, works now. Can't specify distinct names however.
backtesting.py in I(self, func, name, plot, overlay, color, scatter, *args, **kwargs)
119 name = ('{}({})' if params else '{}').format(func_name, params)
120 else:
--> 121 name = name.format(*map(_as_str, args),
122 **dict(zip(kwargs.keys(), map(_as_str, kwargs.values()))))
123
AttributeError: 'tuple' object has no attribute 'format'