When using lightweight-charts, it’s important to note that series initialization happens when you call methods like .addAreaSeries()
or .addCandlestickSeries()
, not at .setData()
. The .setData()
method is used to populate the series with data after it has been created.
Therefore you should assign
const riskZoneSeries = chart.addAreaSeries({
lineColor: 'transparent', // No border for the block
topColor: 'rgba(252, 215, 218, 0.7)', // Transparent red
bottomColor: 'rgba(252, 215, 218, 0.7)', // Same color as top for solid fill
});
before
const candlestickSeries = chart.addCandlestickSeries({
upColor: '#26a69a',
downColor: '#ef5350',
borderVisible: false,
wickUpColor: '#26a69a',
wickDownColor: '#ef5350',
});