I tried the following:
class MACDHisto2(bt.indicators.MACDHisto):
alias = ('MACDHistogram',)
lines = ('histo',)
# colors = ['r','g']
plotlines = dict(histo=dict(_method='bar', alpha=0.50, width=1.0))
def __init__(self):
colord = {True: 'red', False: 'green'}
colors = [colord[histo_0 < 0] for histo_0 in self.lines.histo]
self.plotlines['histo'].update(color=colors)
super(MACDHisto2, self).__init__()
it reports:
File "D:/Python/C1.py", line 82, in __init__
self.plotlines['histo'].update(color=colors)
TypeError: 'AutoInfoClass_pl_LineSeries_pl_LineIterator_pl_DataAccessor_pl_IndicatorBase_pl_Indicator_pl_MACD_pl_MACDHisto_pl_MACDHisto2' object is not subscriptable
Still did not Work...