0

Is there a way to use Python to plot out all possibilities of a candlestick(ohlc) after a certain amount of outcomes?

What is a Candlestick chart? Normally a candlestick chart would look like the image below, each candlestick would be plotted on a single time frame, and there are only 2 different kinds a positive(red) and a negative(white).

enter image description here

So, let's say there are 8-time frames, thus, there will be 8 candlesticks, however, in order to plot out all possible outcomes after 8-time frames, the chart will contain 128 outcomes or 128 candlesticks (considering the candlestick always start with a positive).

These images below is just a simplified illustration of what I'm trying to achieve in the actual chart. A Simplified version

enter image description here Question 1: Now, how do I express that using python?

First, I thought about '1' & '0' could represent the positive and negative, maybe I could use the itertools.product to produce 128 lists (eg: a 3-time frame chart would have 4 lists [(1, 1, 1), (1, 1, 0), (1, 0, 1), (1, 0, 0)] there aren't lists starting with zeros because it always starts positive). and then using candlestick_olhc from matplotlib.finance to plot the graph. But how do I use candlestick_olhc to lay multiple candlesticks within a single time frame?

Question 2: Theoretically, can this method work?

Question3: And is it possible to plot this using matplotlib.finance? if not is there any other tool that I can use to do this?

I'm new to this, so any help would be fantastic! Thank you!

Antony.Liu
  • 11
  • 4
  • The issue I see with this is that you would need to create fake y values to place the candlesticks in the right positions. Theoretically, I think this could be done but you probably can do this much more easily by creating a tree plot using a package that offers this option, like the ones listed [here](https://stackoverflow.com/questions/7670280/tree-plotting-in-python). I can imagine that there is at least one that lets you create the shapes of candlesticks and create something that resembles an x-axis as you want. – Patrick FitzGerald Jan 17 '21 at 17:26
  • Great extra info, I'm almost done with the graph. Thank you Patrick! – Antony.Liu Jan 22 '21 at 04:56

0 Answers0