matplotlib / matplotlib/mplfinance

When saving candle charts to file, the candles are red when should be green. why?

Open
#639 13 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

in think or swim for example, this is the difference between the "CANDLE" style and the "CANDLE TREND" style.

What it appears is happening in MPL Finance using the yahoo style is if the close is below the open then the candle is RED, EVEN IF the close is above the previous days close.

This is very confusing to me and i want to have the candle be green if it closes higher than the previous days close.

Any suggestions?

Here's an example:

https://ibb.co/25hgDLD

Code:

`mpf.plot(data, type='candle', style='yahoo', title=title + charttitle + ' ' + keyDateForImageTitle,
marketcolor_overrides=mco, savefig=savedPlotFileName,addplot=apd)`

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 shown mpf.plot call using type='candle', style='yahoo', and marketcolor_overrides; trace how candle colors are selected from the current and previous closes. Done means a saved Yahoo-style chart colors a candle green when its close is above the previous day's close, including the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.