Skip to content

Histogram indicator plot style #195

Open
@unreal639

Description

@unreal639

I am using the method I to plot MACD, but get the wrong style with histogram.
Maybe need more style settings with the method.

Activity

changed the title [-]MACD indicator plotting style[/-] [+]Histogram indicator plot style[/+] on Dec 13, 2020
AGG2017

AGG2017 commented on Aug 13, 2021

@AGG2017

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:
sample

linked a pull request that will close this issue on Sep 22, 2021
wakandan

wakandan commented on Oct 29, 2021

@wakandan

@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.

ghost
ghost
ghost
ghost
wakandan

wakandan commented on Nov 18, 2021

@wakandan

I ended up implement everything my own. Thanks @vladimircape

quantrung9

quantrung9 commented on May 8, 2022

@quantrung9

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:

image

Do you know how to generate a histogram with multiple colors as @AGG2017 did? Thank you.

kxbin

kxbin commented on Dec 3, 2024

@kxbin

I did it successfully, thanks to everyone under this issue for their help.
image

@quanvnd9 As for the histogram color, you can use:

cm = linear_cmap(source_name, [lightness(BEAR_COLOR, .6), lightness(BULL_COLOR, .6)], low=0, high=0)
r = fig.vbar('index', BAR_WIDTH, source_name, source=source, legend_label=LegendStr(legend_label), color=cm)

For details, please refer to my fork repository https://github.com/kxbin/backtesting.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @wakandan@kernc@quantrung9@kxbin@AGG2017

      Issue actions

        Histogram indicator plot style · Issue #195 · kernc/backtesting.py