You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there the type of choosing a color of bars - by default the bar has a down color if close lower than open.
I want to the option when down color is if close lower than previous bar close, not open of the current bar
And vice versa for up colors, respectively
Yes, this can be done. And I just updated the package to make it easier. First get version 0.12.7a5:
pip install --upgrade mplfinance
Then choose whatever style you want to modify to have the volume color depend on the "price change on day" (i.e. change from previous close). Let's say you want to use style nightclouds, you would do the following:
The kwarg vcdopcod=True is what activates this feature. It stands for "Volume Color Depends On Price Change On Day".
HTH. All the best. --Daniel
Just as a side note: prior to version 0.12.7a5, the only way to do this would be to edit one of the style files and insert vcdopcod=True. See, for example, the file for style charles
By the way, I just realized you didn't mention volume, but I answered the question as regards to volume (when I saw the word "bars" I thought "volume bars").
If you meant for regular candles and/or ohlc bars, there is presently work being done on a new type=hollow_and_filled where the color of the candle is based on the previous close, and then whether the candle is hollow or filled depends on Open vs Close of each given day. (see for example, here, using red, black, hollow, and filled)
Are either of the above two things what you were thinking of?
Or possibly you just want a regular two color candle or ohlc bars where the color depends on the day's close versus the previous days close?
Thanks Daniel
I meant both volume bar and ohlc price bar. I need in my chart all bars will use the colors depends on the previous day close. Like in IbD charts
Activity
DanielGoldfarb commentedon Jan 24, 2021
Pavel,
Yes, this can be done. And I just updated the package to make it easier. First get version 0.12.7a5:
Then choose whatever style you want to modify to have the volume color depend on the "price change on day" (i.e. change from previous close). Let's say you want to use style
nightclouds, you would do the following:The kwarg
vcdopcod=Trueis what activates this feature. It stands for "Volume Color Depends On Price Change On Day".HTH. All the best. --Daniel
Just as a side note: prior to version 0.12.7a5, the only way to do this would be to edit one of the style files and insert vcdopcod=True. See, for example, the file for style charles
DanielGoldfarb commentedon Jan 24, 2021
By the way, I just realized you didn't mention volume, but I answered the question as regards to volume (when I saw the word "bars" I thought "volume bars").
If you meant for regular candles and/or ohlc bars, there is presently work being done on a new
type=hollow_and_filledwhere the color of the candle is based on the previous close, and then whether the candle is hollow or filled depends on Open vs Close of each given day. (see for example, here, using red, black, hollow, and filled)Are either of the above two things what you were thinking of?
Or possibly you just want a regular two color candle or ohlc bars where the color depends on the day's close versus the previous days close?
ghost355 commentedon Jan 24, 2021
Thanks Daniel
I meant both volume bar and ohlc price bar. I need in my chart all bars will use the colors depends on the previous day close. Like in IbD charts
DanielGoldfarb commentedon Jan 24, 2021
Pavel,
That is not yet available, but i think it may be relatively easy to implement. I will look through the code and get back to you. --Daniel
DanielGoldfarb commentedon Feb 22, 2021
This should be easy to implement with a kwarg (and may make it part of style definition too; thinking about that).
Hoping to get to this sometime in the next few weeks.
facealtha commentedon Nov 2, 2022
hello, we would like to contribute to this. Can you please elaborate on what you wish to implement?