Charting Stocks/Forex for Technical Analysis Part 11 - Candlestick and Volume Chart in Matplotlib



This is the eleventh video in the series for stock price analysis, teaching you how to create candlestick and volume graphs in matplotlib. The purpose of the videos in this series is to teach you how to program your own charting and analysis of stocks or Forex. This is beneficial for you if you plan to do any sort of algorithmic, high-frequency, or any sort of automated trading. Sentdex.com Facebook.com/sentdex Twitter.com/sentdex

Comments

  1. The best tutorial that I have been able to follow except for few hiccups. I am currently stuck in candlestick part since is has been deprecated. I have tried downloading the mpl_finance from git but that gives me problem. Is there any way you can shed some light on this?
  2. if you're getting an error you due to matplotlib.finance getting removed soon, but don't know what to do(error message instructions are unclear), you should:

    1) Go to https://github.com/matplotlib/mpl_finance to get the new finance module.

    2) Move mpl_finance.py(you don't need the other files) to site packages directory, which probably is C:\Python27\Lib\site-packages\matplotlib.

    3) Now you can use from matplotlib.mpl_finance import _candlestick. Take note of the syntax change, you need the underscore before "candlestick" now.
  3. After reading the docs, it looks like the matplotlib.dates datenum is the number of days since 0001-01-01 plus 1 day for a correction. Then it seems that you're right you could then convert to unix. Still with current implementation, the only option is to hack around a bit.
  4. If you get this error "from matplotlib.finance import candlestick
    ImportError: cannot import name candlestick" it's because the module name has change from candlestick to _candlestick . from matplotlib.finance import _candlestick
  5. Hi, when I put the mouse at the figure, the number showing at the bottom right for x is in number instead of date format. Any way to overcome this issue?
  6. Enjoying this series!

    I'm searching for a way to avoid the gaps on my chart caused by the market closures on the weekends. Any ideas on how to eliminate (step over) the weekend sections from my chart's x-axis?
  7. Beautiful work, keep it up!
  8. Hey Harrison, I've been getting this error:

    Runtime error!

    Program: c:\python27\pythonw.exe

    This application has requested the runtime to terminate in an unusual way. Please contact the application's support team for more information.

    Any idea what's wrong, or how I can fix this?
  9. waaaaaaaaooooooooooo!!!!!!
  10. Hey Harrison, great vids man I'm learning a lot. still need to watch your matplotlib tutorial vids as I have no clue what half this stuff means/ does but i got a queation for ya man. When I run the module this message pops up:

    Warning (from warnings module):
      File "C:\Users\gthomp16\Anaconda\lib\site-packages\matplotlib\finance.py", line 865
        mplDeprecation)
    MatplotlibDeprecationWarning: This function has been deprecated in 1.4 in favor of `candlestick_ochl`, which maintains the original argument order, or `candlestick_ohlc`, which uses the open-high-low-close order. This function will be removed in 1.5

    No idea what this means. I'm thinking it is because I'm using anaconda. 

    - Thanks man keep up the good work!
  11. Hi. How I can make candlestick from intra-day stock data. I always have  mistake 'unconverted data remains'
  12. Looks like you can use something like this to get the candle array:
    rowmaker = lambda row: (mdates.date2num(row[0]), row[1][0], \
                            row[1][3], row[1][1], \
                            row[1][2], row[1][4])
    candle_array = [rowmaker(row) for row in df.iterrows()]

    Where df.columns = Index([u'Open', u'High', u'Low', u'Close', u'Volume', u'Adj Close'], dtype='object')

    iterows gives rows as a tuple; row[0] is index (here date as timestamp) , row[1] is a tuple containing the row values in same order as df.columns.

    So currently bit of a PIA to use with dataframes - but doable (with a bit of help from your tutorial)!
  13. Is it possible to set a default window size for the chart window? 
  14. Congrats for your tutorials but for replication purposes Where can I find the source code to better understand it ?

    Marcel


Additional Information:

Visibility: 8464

Duration: 10m 11s

Rating: 44