matplotlib / matplotlib/mplfinance

add scatter points to renko plot

Open
#448 5 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

@DanielGoldfarb ... thank you for your wonderful work.

Hello can someone help me to add scatter points to my renko chart.
All i am trying to do is add scatter chart to existing chart(ie marker) "o" where volume is > 500 in my data.

sample Data structure - csv file:

time,Open,High,Low,Close,Volume,date
2020-06-16 09:33,2439.0,2439.0,2439.0,2439.0,340.0,2020-06-16 09:33:03.872999936-04:00
2020-06-16 10:25,2450.5,2450.5,2450.5,2450.5,521.0,2020-06-16 10:25:01.012000-04:00
2020-06-16 10:30,2440.0,2440.0,1440.0,2440.0,415.0,2020-06-16 10:30:13.260999936-04:00
2020-06-16 10:30,2429.5,2429.5,2429.5,2429.5,770.0,2020-06-16 10:30:20.295000064-04:00

Basic code:

df = []
df = pd.read_csv('test.csv',index_col=0,parse_dates=True)
df = df.iloc[:20000]
bucket_size = 0.00012 * max(df['Close'])
volprofile  = df['Volume'].groupby(df['Close'].apply(lambda x: bucket_size*round(x/bucket_size,0))).sum()
mc = mpf.make_marketcolors(base_mpf_style='yahoo')
s  = mpf.make_mpf_style(base_mpf_style='nightclouds',marketcolors=mc)
fig, axlist = mpf.plot(df,type='renko',renko_params=dict(brick_size=3),returnfig=True,style=s,tight_layout=True)
vpax = fig.add_axes(axlist[0].get_position())
vpax.set_axis_off()
vpax.set_xlim(right=1.2*max(volprofile.values))
mpf.show()

current sample image:
image

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

Start with the mpf.plot(..., type='renko', returnfig=True) call and the returned axlist in the provided example. Read how Renko plots expose their axes and how the supplied Volume values relate to the plotted data. Done means documenting or implementing a way to show marker points for rows whose volume exceeds 500 on the Renko chart.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.