Skip to content

Financial plots with growing data #403

@Minu476

Description

@Minu476

after plotting this code:

Random rand = new Random(0);
double[] xs = DataGen.Consecutive(150);
OHLC[] ohlcs = DataGen.RandomStockPrices(rand, xs.Length);
(var sma, var bolL, var bolU) = ScottPlot.Statistics.Finance.Bollinger(ohlcs);

// replace timestamps with a series of numbers starting at 0xs
for (int i = 0; i < ohlcs.Length; i++)
    ohlcs[i].time = i;

var plt = new ScottPlot.Plot(600, 400);
plt.PlotCandlestick(ohlcs);
plt.PlotFill(xs, bolU, xs, bolL, "bollinger", 1, Color.Black, true, Color.Aqua, 0.3);
plt.PlotScatter(xs, sma, color: Color.Blue, markerSize: 0, lineStyle: LineStyle.Dash);

How we update it by adding one new candle and corresponding bollinger bands values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions