matplotlib / matplotlib/mplfinance

Can this MACD Gradient Histogram Included As A New Feature?

Open
#594 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
4.4k
Forks
678
PR merge metrics
No merged PRs in 30d

Description

I Have Taken Inspiration From Trading View MACD Histogram
![TCS_2023-03-07_15-35-55](https://user-images.githubusercontent.com/127198654/223399413-3c6361a6-707a-4b2f-94d1-289f964cee79.png)
```python
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),
```
![Trading View](https://user-images.githubusercontent.com/127198654/223399758-8dbc4991-eea9-442f-8291-8beb0257b501.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a Python color-selection snippet and TradingView screenshots, but names no repository files or tests. Start by locating the existing MACD histogram and addplot color-handling entry points, then determine how the requested four-state gradient should be exposed and tested; done means histogram bars visibly use those colors based on adjacent values.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.