Questions tagged [mplfinance]

questions relating to python package "mplfinance" (which is part of the "matplotlib" organization)

How to Install

# at the Anaconda prompt if using the Anaconda distribution
conda install -c conda-forge mplfinance

# if not using Anaconda
pip install --upgrade mplfinance
163 questions
45
votes
10 answers

Since matplotlib.finance has been deprecated, how can I use the new mpl_finance module?

I am trying to import matplotlib.finance module in python so that I can make a Candlestick OCHL graph. My matplotlib.pyplot version is 2.00. I've tried to import it using the following commands: import matplotlib.finance from matplotlib.finance…
Furqan Hashim
  • 1,304
  • 2
  • 15
  • 35
19
votes
4 answers

How can I customize mplfinance.plot?

I've made a python script to convert a csv file in a candlestick like this using mpl_finance, this is the script: import matplotlib.pyplot as plt from mpl_finance import candlestick_ohlc import pandas as pd import matplotlib.dates as…
Matteo_Sid
  • 252
  • 1
  • 2
  • 11
14
votes
3 answers

Why can't I import candlestick_ohlc from mplfinance

So I have been able to successfully install mplfinance with pip and when I import it alone I receive no error. Though when I do: from mplfinance import candlestick_ohlc I get the error ImportError: cannot import name 'candlestick_ohlc' from…
8
votes
1 answer

How can I deal with Expect data.index as DatetimeIndex?

I am planning to get a candlestick plot from the bitcoin data. Here is my code for select the dataframe I want after loading the csv file. df['Date'] = pd.to_datetime(df['Date']) start_date = '2016-02-27' end_date = '2021-02-27' mask = (df['Date']…
dezmeko
  • 81
  • 1
  • 1
  • 4
7
votes
1 answer

Separate panels in mplfinance

I would like to separate my panels because the titles superposed. ADX title is in RSI panel. I tried with tight_layout=True but still the same. My code: ap0 = [ mpf.make_addplot(df['sma_200'],color='#FF0000', panel=2), …
Martin Bouhier
  • 212
  • 2
  • 12
7
votes
3 answers

Charting Candlestick_OHLC one minute bars with Pandas and Matplotlib

Given the following example of Pandas dataframe date open high low close volume 0 2015-03-13 08:00:00 71.602 71.637 71.427 71.539 0.000249 1 2015-03-13 08:01:00 71.541 71.563 71.461 71.501 …
RaduS
  • 2,465
  • 9
  • 44
  • 65
6
votes
3 answers

How to install mpl_finance packages into environment on Anaconda?

How to install the mpl_finance package into the environment path on Anaconda? I tried pip install mpl_finance but I still can't find the package on Anaconda, where did it go? I am pretty fresh in Python.
jihao yu
  • 61
  • 1
  • 1
  • 2
4
votes
1 answer

How to add a string comment above every single candle using mplfinance.plot() or any similar package?

i want to add a string Comment above every single candle using mplfinance package . is there a way to do it using mplfinance or any other package ? here is the code i used : import pandas as pd import mplfinance as mpf import matplotlib.animation…
Mr Dream
  • 134
  • 1
  • 10
4
votes
1 answer

is there an equivalent of plt.scatter in mplfinance? How to you graph data points in mplfinance?

What is the equivalent of plt.scatter in mplfinance??? I am graphing stock prices using mpl finance. def graph(): file = 'prices1.xlsx' data = pd.read_excel(file, sheet_name = stockQuote) data.Date = pd.to_datetime(data.Date) data =…
4
votes
1 answer

Possible memory leak when using mplfinance/matplotlib. How to solve it?

I am trying to make a lot (~1.7 mil) of images (candlesticks charts with volume) for a CNN. However, the script I currently have keeps increasing its memory usage after each iteration with about 2-5mb per iteration as far is I can tell. This…
RKoppe
  • 43
  • 4
4
votes
1 answer

Is it possible to join two charts, one plotted with matplotlib.pyplot and the other plotted with mplfinance into the same figure. eg; same image

I am plotting two charts. One bar chart with matplotlib.pyplot and a second candle chart with mplfinance and I want to show them stacked on top of one another in the same figure (image). I have found examples of how to stack plots done with…
user2109254
  • 1,709
  • 2
  • 30
  • 49
4
votes
1 answer

How do I draw the support and resistance lines on a candlestick graph using mplfinance?

I need to draw two horizontal lines to show support and resistance. Here is my code: from alpha_vantage.timeseries import TimeSeries import mplfinance as mpf ts = TimeSeries(key='', output_format='pandas', indexing_type='date') data, meta_data =…
4
votes
4 answers

How to Remove Weekends in Matplotlib Candlestick Chart?

When plotting a candlestick chart in matplotlib, the plot leaves unsightly gaps over weekends. This happens because of breaks in the data due to markets being closed on weekends. How can the gaps over weekends be removed? Below is a simple example…
lanery
  • 5,222
  • 3
  • 29
  • 43
3
votes
1 answer

mplfinance moving average gaps and exponential moving averages

I am printing moving averages on a mplfinance plot, as expected there are gaps. On most charting software, i.e. TradingView etc, they do not have gaps on the moving averages - and presume they are pulling the data from previous -n elements (even…
morleyc
  • 2,169
  • 10
  • 48
  • 108
3
votes
1 answer

mplFinance edit x-axis to show seconds

I am wondering if there is a way to have an MPLFinance plot show more keys(time) and seconds as well as minutes. I know you are able to add the minute, but can't find anywhere to add the seconds.
Xobiwan
  • 47
  • 4
1
2 3
10 11