0

I have a Dataframe Like Below:

        Symbol            DateTime      open      high       low     close   volume
0    BANKNIFTY 2019-09-09 09:15:00  27266.20  27266.20  27063.20  27115.00  19200.0
1    BANKNIFTY 2019-09-09 09:16:00  27112.85  27118.90  27096.10  27101.95   6820.0
2    BANKNIFTY 2019-09-09 09:17:00  27105.00  27142.35  27105.00  27135.95      0.0
3    BANKNIFTY 2019-09-09 09:18:00  27130.55  27140.00  27106.95  27113.00  12560.0
4    BANKNIFTY 2019-09-09 09:19:00  27113.55  27113.55  27077.00  27090.55      0.0
5    BANKNIFTY 2019-09-09 09:20:00  27083.05  27083.05  27039.15  27071.85  21260.0
6    BANKNIFTY 2019-09-09 09:21:00  27079.00  27099.00  27070.55  27080.00   2720.0
7    BANKNIFTY 2019-09-09 09:22:00  27082.45  27091.60  27071.05  27088.65      0.0
8    BANKNIFTY 2019-09-09 09:23:00  27086.65  27099.40  27081.20  27088.70      0.0
9    BANKNIFTY 2019-09-09 09:24:00  27085.45  27094.00  27079.95  27084.90      0.0
10   BANKNIFTY 2019-09-09 09:25:00  27084.90  27084.90  27070.00  27074.85      0.0
11   BANKNIFTY 2019-09-09 09:26:00  27074.85  27080.00  27070.00  27074.00      0.0
12   BANKNIFTY 2019-09-09 09:27:00  27073.05  27075.00  27065.70  27066.05      0.0
13   BANKNIFTY 2019-09-09 09:28:00  27066.05  27086.65  27062.00  27084.90      0.0
14   BANKNIFTY 2019-09-09 09:29:00  27085.45  27108.80  27080.05  27101.25      0.0
15   BANKNIFTY 2019-09-09 09:30:00  27100.00  27100.85  27076.00  27079.50   2900.0
16   BANKNIFTY 2019-09-09 09:31:00  27079.00  27114.00  27079.00  27113.95   3900.0
17   BANKNIFTY 2019-09-09 09:32:00  27110.00  27118.95  27102.70  27103.30      0.0

I want to plot the data in OLHCV using matplotlib with below conditions:

  1. Where Close > Open then Candle Color = Green
  2. Where Close < Open then Candle Color = Red
  3. Where Volume is Non-Zero then Candle Color = Blue
  4. Plot Volume Candle (only for non Zero Volume values) as Horizontal Lines from Right side upto the Current Candle Close Value with Volume Value written on top of the line.

Any Help...

Sample Output will be like: Output

Rohit Lamba K
  • 510
  • 1
  • 4
  • 11
  • Please try working on it yourself first, and then posting a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) if you encounter problems. – shynjax287 Oct 22 '19 at 06:33
  • Sir, I am new to matplotlib and able to plot candles with red and green color as of date. I will be grateful if you can help. – Rohit Lamba K Oct 22 '19 at 06:42
  • Possible duplicate of [how to plot ohlc candlestick with datetime in matplotlib?](https://stackoverflow.com/questions/36334665/how-to-plot-ohlc-candlestick-with-datetime-in-matplotlib) – 4Oh4 Oct 23 '19 at 08:38
  • No Sir, my requirements are different. – Rohit Lamba K Oct 23 '19 at 17:33

0 Answers0