Open/High/Low/Close

Source code Author Update time

using Plots
pythonplot()

Create an OHLC chart. Pass in a list of (open,high,low,close) tuples as your y argument. This uses recipes to first convert the tuples to OHLC objects, and subsequently create a :path series with the appropriate line segments.

n = 20
hgt = rand(n) .+ 1
bot = randn(n)
openpct = rand(n)
closepct = rand(n)
y = OHLC[(openpct[i] * hgt[i] + bot[i], bot[i] + hgt[i], bot[i], closepct[i] * hgt[i] + bot[i]) for i = 1:n]
ohlc(y)
2023-01-27T18:03:57.994890 image/svg+xml Matplotlib v3.6.3, https://matplotlib.org/

This page was generated using DemoCards.jl and Literate.jl.