Market analysis plotting

Hello guys,
I’m developing a fin. market analysis webapp and need to plot a price chart (OHLC data) with some additional simple graphics, like rectangles, polylines, curves, text. A plot doesn’t necessarily has to be interactive.
An example from Metatrader looks like this:


(don’t trade this! it is just an example of graphics)

Can you please advice me “the right package” for this?
Thanks in advance and best regards.

1 Like

I won’t trade that, it is rare to see someone into AUD/JPY,

Packages that can be used:

  1. CSV
  2. Dates
  3. DataFrames
  4. Plots
  5. RollingFunctions

For example this code works, I tried before (if you want to load data from CSV from investing.com):

using CSV, Dates, DataFrames, Plots, Plots.PlotMeasures, RollingFunctions

fileindy = "./csv/IDX-Stocks/INDY Historical Data.csv"

dfindy = CSV.read(fileindy, DataFrame)

dfindy.Price .= parse.(Float64, replace.(dfindy.Price, "," => ""))
dfindy[!,"Change %"] .= parse.(Float64, replace.(dfindy[!,"Change %"], "%" => ""))

dfindy.Dates = Date.(dfindy.Date, "mm/dd/yyyy")
tick_years = Date.(unique(Dates.year.(dfindy.Dates)))
DateTick = Dates.format.(tick_years, "yy")
xlimsindy = extrema([tick_years; dfindy.Dates])

p1 = plot(dfindy.Dates, dfindy.Price, title="",
    xticks=(tick_years,DateTick), xlims=xlimsindy,
    label="Indika Energy (Price)", xlabel="", ylabel="")

# Set up MA and Bollinger Band
prices = dfindy.Price;
moving_average = rollmean(prices, 20);
moving_std = rollstd(prices, 20);

bollinger_high = moving_average .+ 2moving_std;
bollinger_low = moving_average .- 2moving_std;

p2 = plot([moving_average bollinger_low bollinger_high], 
	label = ["Moving average" "Low" "High"], ls = [:solid :dash :dash])

plot(p1, p2, size=(900,800), layout = (2, 1), 
    legend=:outerright, left_margin=10mm, bottom_margin=5mm,
     xaxis = "", yaxis = "")

The plot should look like this
Capture d’écran_2023-05-09_20-13-52

If you want to build a hollow rectangle just use this for example:

plot!([2,2],[0,2], label="", linecolor=:green)
plot!([2,0],[2,2], label="", linecolor=:green)
plot!([0,2],[0,0], label="", linecolor=:green)
plot!([0,0],[2,0], label="", linecolor=:green)

...

I’d say a plot like this that’s noninteractive can be done in any plotting package, so if you want a specific recommendation you probably need to have stricter requirements :slight_smile:

Here’s an example of a candlestick plot from some years ago, based on Plots.jl: Julia add indicator to candlestick chart - Stack Overflow