Open
Description
I Have Taken Inspiration From Trading View MACD Histogram
macd_color = []
for i,v in enumerate(df["MACD_histogram"]):
if df["MACD_histogram"][i] >= 0 and df["MACD_histogram"][i-1] < df["MACD_histogram"][i]:
macd_color.append('#26A69A')
elif df["MACD_histogram"][i] >= 0 and df["MACD_histogram"][i-1] > df["MACD_histogram"][i]:
macd_color.append('#B2DFDB')
elif df["MACD_histogram"][i] < 0 and df["MACD_histogram"][i-1] > df["MACD_histogram"][i] :
macd_color.append('#FF5252')
elif df["MACD_histogram"][i] < 0 and df["MACD_histogram"][i-1] < df["MACD_histogram"][i] :
macd_color.append('#FFCDD2')
else:
macd_color.append('#FFCDD2')
mpl.make_addplot(histogram,type='bar',width=0.7,panel=2, color=macd_color,alpha=1,secondary_y=True),