Skip to content

Plot.py ‐ Basic Usage

Benny Thadikaran edited this page Aug 15, 2023 · 23 revisions

Plot.py has been rewritten to provide many additional options and improved charts. It works like any command line application with options.

Plotting a chart

To plot a single chart, use the --sym option providing the symbol name.

py plot.py --sym tcs

TCS basic chart

Press 'q' to quit the chart.

By default, plot.py uses the daily timeframe. To display weekly timeframe charts, use --tf option.

py plot.py --sym tcs --tf weekly

Chart Indicators

Volume

To add volume, use -v or --volume

py plot.py --sym sunpharma -v

Sunpharma chart with volume

Moving Averages

To add simple moving average to the chart, use --sma

py plot.py --sym icicibank --sma 50

To add multiple moving averages, use space separated values

py plot.py --sym icicibank --sma 50 100 200

Icicibank chart with 50, 100 and 200 sma

Dorsey Relative Strength

This is calculated by dividing the stock closing price by the index closing price. It uses 'Nifty 50' by default but can be configured to use any index.

A rising RS indicates the stock is outperforming the index and vice versa. You can read this excellent article on Dorsey Relative Strength - chartmill.com for more info.

To add this indicator to chart, use --rs option

py plot.py --sym escorts --rs

Escorts chart with Dorsey Relative strength indicator

Manfeild Relative Strength (MRS)

I read about MRS in Stan Weinstein's book 'Secrets For Profiting in Bull and Bear Markets'. I highly recommend you to read this book.

The MRS is calculated by dividing the regular RS by its 52 period moving average.

MRS = ( RS / SMA(RS, 52) - 1) * 100

This essentially compares the RS to its 52 period moving average.

  • MRS is 0, if RS is exactly equal to its moving average.
  • MRS is below 0, if RS is below its moving average.
  • MRS is above 0, if RS is above its moving average.

This is the same as Dorsey RS with the additional MA comparison.

You can read more on Manfeild Relative Strength - chartmill.com. Also read Stan Weinstein's book which provides numerous examples on using this indicator.

To add this indicator to chart, use --m-rs option. It is best used with the weekly chart. Notice the helpful zero line (dashed line) on the indicator in the chart below.

py plot.py --sym tcs --tf weekly --m-rs

M&M weekly chart with Manfield relative strength indicator

To replicate the charts from Stan Weinstein's book, see below

py plot.py --sym tcs --tf weekly -v --m-rs --sma 30

TCS weekly chart with 30 Week MA, Manfield RS and volume

Support and Resistance

We can plot support and resistance lines on chart with the --snr option.

  • To mark a resistance level, 2 candles with successive highs must be followed by 2 candles with successive lows.
  • To mark a support level, 2 candles with successive lows must be followed by 2 candles with successive highs.

To simplify, its a 4 bar V shaped price rejection. It's not perfect but does its job reasonably well.

Ratnamani weekly chart with support and resistance

You don't have to type all these options every time. I will show you an easier way in the next section.

Play around with these options and familiarize yourself before moving to the next section.

Next we work with watchlists and presets.