matplotlib / mplfinance

Financial Markets Data Visualization using Matplotlib
https://pypi.org/project/mplfinance/
Other
3.49k stars 613 forks source link

OHLC Bar Coloring - Not based on Increasing / Decreasing Bars #217

Open crossjbeer opened 3 years ago

crossjbeer commented 3 years ago

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.

DanielGoldfarb commented 3 years ago

duplicate of #205 Please see comment here.

alexpvpmindustry commented 1 year ago

@crossjbeer see the last cell in marketcolor_overrides.ipynb