How to Create Bollinger Bands and Moving Average in Julia with Plots and DataFrame?

You probably want to use RollingFunctions

julia> using RollingFunctions

julia> prices = rand(100);

julia> moving_average = rollmean(prices, 20);

julia> moving_std = rollstd(prices, 20);

julia> bollinger_high = moving_average .+ 2moving_std;

julia> bollinger_low = moving_average .- 2moving_std;

julia> using Plots

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