You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All parameters how to plot one indicator should be just one style parameter as list of dictionaries, one for each element of the indicator. Then you can specify for MACD to have 2 line elements and one histogram with the corresponding colors and names.
I did some experiments and added a complex style parameter where the user can select even size, transparency, type, color, name etc. of each element of one indicator but it needs much more work before proposing this option. Something like this:
@AGG2017 how did you specify the legends for each of the lines in 1 indicator graph? Could you share the code for this? I'm trying to draw MACD signal like this too. Thanks.
Activity
[-]MACD indicator plotting style[/-][+]Histogram indicator plot style[/+]Add Histogram indicator plot style kernc#195
Add Histogram indicator plot style kernc#195
Merge pull request #5 from zlpatel/kernc#195
Fix legends values on histogram kernc#195
Fix lint issues kernc#195
Fix lint issues kernc#195
Fix lint issues kernc#195
Fix lint issues kernc#195
Fix lint issues kernc#195
Merge pull request #6 from zlpatel/kernc#195
Add Histogram indicator plot style kernc#195
Merge branch 'kernc#195' of https://github.com/zlpatel/backtesting.py …
Add Histogram indicator plot style kernc#195
AGG2017 commentedon Aug 13, 2021
All parameters how to plot one indicator should be just one style parameter as list of dictionaries, one for each element of the indicator. Then you can specify for MACD to have 2 line elements and one histogram with the corresponding colors and names.
I did some experiments and added a complex style parameter where the user can select even size, transparency, type, color, name etc. of each element of one indicator but it needs much more work before proposing this option. Something like this:

wakandan commentedon Oct 29, 2021
@AGG2017 how did you specify the legends for each of the lines in 1 indicator graph? Could you share the code for this? I'm trying to draw MACD signal like this too. Thanks.
wakandan commentedon Nov 18, 2021
I ended up implement everything my own. Thanks @vladimircape
quantrung9 commentedon May 8, 2022
Hi @vladimircape,
Your tutorial is great. I did it but still cannot generate a histogram with different colors for positive and negative ones.
For now, the histogram has only one color:
Do you know how to generate a histogram with multiple colors as @AGG2017 did? Thank you.
kxbin commentedon Dec 3, 2024
I did it successfully, thanks to everyone under this issue for their help.

@quanvnd9 As for the histogram color, you can use:
For details, please refer to my fork repository https://github.com/kxbin/backtesting.py