79228050

Date: 2024-11-26 19:46:35
Score: 0.5
Natty:
Report link

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',
        });
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: Prabhu Egorus