matplotlib / matplotlib/mplfinance
OHLC Bar Coloring - Not based on Increasing / Decreasing Bars
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 678
- PR merge metrics
- No merged PRs in 30d
Description
I am running a BackTest to simulate equity from a given trading strategy. We are using MPLFinance to plot the OHLC Bars of the stock we are trading. Our project requires OHLC Bars to be colored based on the trade taken at a given index. For example, if the strategy recommends a Buy order at market open, we would like the bar at market open to appear red.
After reading through the documentation, it seems there is substantial support for custom colors on the plots. This customization happens primarily through the make_markretcolors function. However, it seems the bars are always colored according to whether they are increasing or decreasing. I have been so far unable to pinpoint the segment of code I should amend to or modify to change this behavior.
Thank you for any help you can provide, and have a great day.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the make_markretcolors function and the plotting path that chooses increasing versus decreasing bar colors; the issue does not name a file or test. The work is done when OHLC bars can use colors supplied for the trade at each index instead of always following bar direction, with the relevant documentation or tests updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100