-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When saving candle charts to file, the candles are red when should be green. why? #639
Comments
Please provide the exact data and code used to generate the example plot, so that the questionable candle is 100% reproducible from the data and code. |
As a general rule, for all traditional candlestick charts, the color of a candle depends entirely on whether the Close for that candle is higher than the Open of the same candle (green) or whether the Close is lower than the Open (red), with no dependence on previous candles. Within mplfinance styles, there is a parameter Additionally, mplfinance now supports |
Yes that’s the issue. I want the candle color
To be relative to the close of the prior candle. Not relative to its own open price
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Tuesday, July 4, 2023 6:50:09 AM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Author ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
As a general rule, for all traditional candlestick charts, the color of a candle depends entirely on whether the Close for that candle is higher than the Open of the same candle (green) or whether the Close is lower than the Open (red), with no dependence on previous candles.
Within mplfinance styles, there is a parameter 'vcdopcod' which stands for "volume color depends on previous close on day," which happens to be True for style yahoo<https://github.com/matplotlib/mplfinance/blob/master/src/mplfinance/_styledata/yahoo.py>, however this only affects the volume bar colors and not the candle colors.
Additionally, mplfinance now supports type='hollow', aka type='hollow_and_filled', which differs from type='candle' in that the color of the candle does depend on the change from the previous Close, while the body of the candle is filled or hollow based on whether the Close is down from the Open, or up from the Open.
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6KBAT24NVOKE6GVZKTXOP7PDANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@TraderMan999 |
Thank you. Yes #2 is my preference. I understand there are multiple ways people consider “normal” and for the charts I produce the green and red is more normal to be based in the precious candle
Is that value available already in the api? How should I start? I’m new to extending this api
Much appreciated!
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Sunday, July 9, 2023 5:48:23 PM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
@TraderMan999<https://github.com/TraderMan999>
As mentioned, traditional candlestick charts are colored based on the difference between the open and the close for each candle, so you have two alternatives: (1) use hollow and filled candles, or (2) enhance mplfinance to accept a kwarg that says to color each candle based the difference between the candle's close and the previous candle's close. If you want to do (2), and are unsure how to do it, then I can guide you through the process.
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6OHSTBMIFVCLT3VKB3XPMYLPANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@TraderMan999 I suggest you try using |
Ok I will try that when I get home. Would be awesome if something as simple does it!
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Wednesday, July 12, 2023 11:32:56 AM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
@TraderMan999<https://github.com/TraderMan999>
I finally took the time to read thinkorswim<https://tlc.thinkorswim.com/center> and, from what I can tell, the CANDLE TREND Chart<https://tlc.thinkorswim.com/center/howToTos/thinkManual/charts/Chart-Modes/Chart-Types/candletrend> is exactly what mplfinance calls type='hollow'.
I suggest you try using type='hollow' in your call to mpf.plot(). That should give you exactly what thinkorswim<https://tlc.thinkorswim.com/center> describes as a Candle Trend Chart.
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6O4BPCXHDCII3ZWPEDXP3GTRANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I forgot to respond but that did what I needed.
Now by default the times on the x axis are not what I want. I’d rather they show the 930 est open etc. Is there a way to change those to be the ones I want?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Steve Conlon ***@***.***>
Sent: Wednesday, July 12, 2023 3:44:12 PM
To: matplotlib/mplfinance ***@***.***>; matplotlib/mplfinance ***@***.***>
Cc: Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
Ok I will try that when I get home. Would be awesome if something as simple does it!
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Wednesday, July 12, 2023 11:32:56 AM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
@TraderMan999<https://github.com/TraderMan999>
I finally took the time to read thinkorswim<https://tlc.thinkorswim.com/center> and, from what I can tell, the CANDLE TREND Chart<https://tlc.thinkorswim.com/center/howToTos/thinkManual/charts/Chart-Modes/Chart-Types/candletrend> is exactly what mplfinance calls type='hollow'.
I suggest you try using type='hollow' in your call to mpf.plot(). That should give you exactly what thinkorswim<https://tlc.thinkorswim.com/center> describes as a Candle Trend Chart.
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6O4BPCXHDCII3ZWPEDXP3GTRANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I don't know what you are asking. What exactly are you seeing? What exactly do you want to see instead? |
For example if mi wanted to set it up for different charts to show midnight, 930am est etc bs the random times circled below:
[Image]
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Sunday, August 6, 2023 6:11:55 PM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
Now by default the times on the x axis are not what I want. I’d rather they show the 930 est open etc. Is there a way to change those to be the ones I want?
I don't know what you are asking. What exactly are you seeing? What exactly do you want to see instead?
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6JU5S4CPKKY2EXLCUTXUAQDXANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@TraderMan999 Rather go to GitHub.com and add your comment and images here |
[Image]
Trying again
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Daniel Goldfarb ***@***.***>
Sent: Wednesday, August 9, 2023 9:22:29 PM
To: matplotlib/mplfinance ***@***.***>
Cc: TraderMan999 ***@***.***>; Mention ***@***.***>
Subject: Re: [matplotlib/mplfinance] When saving candle charts to file, the candles are red when should be green. why? (Issue #639)
@TraderMan999<https://github.com/TraderMan999>
The image you tried to attach does not show.
Do not reply by email. It does not work!
Rather go to GitHub.com and add your comment and images here<#639>
—
Reply to this email directly, view it on GitHub<#639 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZCNE6MOWDHE37OKEONUECTXURAWLANCNFSM6AAAAAAZ3YOQTU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Posting to GitHub by email does NOT work (they have bugs). You need to go directly to the issue on the github website and post there. |
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)
The text was updated successfully, but these errors were encountered: