I am trying to use Plotly to set up a browser-based financial monitoring console. So far the candlesticks are working great, but I want to add some indicators such as moving averages, bollinger bands, etc. I can’t seem to find anywhere in the documentation that explicitly shows how to do this. When I try to add both candlesticks and line chart data to a plot, it will only plot the line chart. Is it possible to do what I am looking for, or am I beating my head up against a limitation of the service?
Using PlotlyFinance.createCandlestick
of the plotly.js finance wrapper yields an object, call it fig
, with keys data
and layout
.
To add a line trace to your chart simply append the fig.data
array with a new trace.
For example,
var fig = PlotlyFinance.createCandlestick({/* options */});
fig.data.push({
type: 'scatter',
mode: 'lines',
x: [1,2,3],
y: [2,1,2]
});
Plotly.plot('myDiv', fig.data, fig.layout);
Hope this helps!
That project is now marked as deprecated… So can we add a scatter diagram to a candlestick diagram?
Should be possible I guess…