Plotting OHLC bars with TimeSeries.jl and GR.jl

Viewed 36

I am using the following taken from the examples https://juliastats.org/TimeSeries.jl/latest/plotting/

using Plots
using TimeSeries
gr()

ta = [[1,5,0,2]]
plot(ta, seriestype = :candlestick)

But I'm getting the error

ERROR: LoadError: The backend must not support the series type Val{:candlestick}, and there isn't a series recipe defined.
1 Answers

It has to be a TimeArray

data = (datetime = [DateTime(2018, 11, 21, 12, 0), DateTime(2018, 11, 21, 13, 0)],
        open = [1, 11.2],
        high = [5, 21.2],
        low = [0, 31.2],
        close = [2, 31.2])
ta = TimeArray(data; timestamp = :datetime, meta = "Example")
Related