Reusable React chart components including:
- 📈 Candlestick Charts
- 🔁 RSI Panels
- 📊 MACD Panels
This package is distributed under a custom restrictive license.
You may only use it for personal, non-commercial, and informational purposes. Any other use—including academic, production, or derivative work—is strictly prohibited. See the LICENSE file included in the package for full terms.
npm install @bullsense/react-trade-charts
Import components and prepare your OHLC data:
import {
CandlestickChart,
RSIPanel,
MACDPanel,
} from '@bullsense/react-trade-charts';
const sampleData = rawData.map(item => ({
date: String(item.t),
open: Number(item.o),
high: Number(item.h),
low: Number(item.l),
close: Number(item.c),
volume: Number(item.v),
}));
const [startIndex, setStartIndex] = useState(
Math.max(0, sampleData.length - 100)
);
const limit = 100; //default is 100
const visibleData = sampleData.slice(startIndex, startIndex + limit);
import { ZoomableCandlestickChart } from '@bullsense/react-trade-charts';
<ZoomableCandlestickChart
data={sampleData}
width={1200}
chartHeight={500}
rsiHeight={150}
macdHeight={200}
minLimit={30}
maxLimit={300}
initialLimit={100}
initialStartIndex={sampleData.length - 100}
showRSI={true}
showMACD={true}
chartProps={{
config: {
showLegend: true,
showGrid: true,
showVolume: true,
showCrosshair: true,
lineGradient: true, // new setting
},
styles: {
backgroundColor: '#181830',
upColor: '#00F5A0',
downColor: '#FF427A',
legendTextColor: '#fff',
legendBackground: 'rgb(0 0 0 / 33%)',
},
indicators: [
{ type: 'SMA', period: 20, color: 'orange' },
{ type: 'SMA', period: 50, color: 'red' },
{ type: 'EMA', period: 12, color: 'purple' },
{ type: 'BollingerBands', period: 20, multiplier: 2, color: 'blue' },
],
}}
rsiProps={{
styles: {
backgroundColor: '#181830',
lineColor: '#ffffff',
textColor: '#ccc',
borderColor: '#333',
overboughtColor: '#ff4d4f',
oversoldColor: '#52c41a',
midlineColor: '#888',
gridColor: '#444',
overbought: 70,
oversold: 30,
period: 14,
},
}}
macdProps={{
styles: {
backgroundColor: '#181830',
macdColor: '#00BFFF',
signalColor: '#FFA500',
histogramUpColor: '#33cc99',
histogramDownColor: '#ff4d4f',
textColor: '#ccc',
borderColor: '#333',
},
}}
/>;
<CandlestickChart
visibleData={visibleData}
fullData={sampleData}
width={1200}
height={500}
startIndex={startIndex}
onScrollChange={setStartIndex}
limit={limit}
dataLength={sampleData.length}
type="candlestick|line"
config={{
showLegend: true,
showGrid: true,
showVolume: true,
showCrosshair: true,
}}
styles={{
backgroundColor: '#181830',
upColor: '#00F5A0',
downColor: '#FF427A',
legendTextColor: '#fff',
legendBackground: 'rgb(0 0 0 / 33%)',
}}
indicators={[
{ type: 'SMA', period: 20, color: 'orange' },
{ type: 'SMA', period: 50, color: 'red' },
{ type: 'SMA', period: 200 },
{ type: 'EMA', period: 12, color: 'purple' },
{
type: 'BollingerBands',
period: 20,
color: 'blue',
multiplier: 2,
},
]}
/>
-
lineGradient
: Whentype="line"
, enables a fading gradient below the line using the same color as the line.
<RSIPanel
visibleData={visibleData}
fullData={sampleData}
startIndex={startIndex}
limit={limit} // If you want to a seamless experience, use the same limit for all of them
width={1200}
height={150}
showBorder={false}
margin={{ top: 10, bottom: 20, left: 50, right: 10 }}
styles={{
backgroundColor: '#181830',
lineColor: '#ffffff',
textColor: '#ccc',
borderColor: '#333',
overboughtColor: '#ff4d4f',
oversoldColor: '#52c41a',
midlineColor: '#888',
gridColor: '#444',
overbought: 70,
oversold: 30,
period: 14,
}}
/>
<MACDPanel
visibleData={visibleData}
fullData={sampleData}
startIndex={startIndex}
width={1200}
height={200}
showBorder={false}
margin={{ top: 10, bottom: 20, left: 50, right: 10 }}
styles={{
backgroundColor: '#181830',
macdColor: '#00BFFF',
signalColor: '#FFA500',
histogramUpColor: '#33cc99',
histogramDownColor: '#ff4d4f',
textColor: '#ccc',
borderColor: '#333',
}}
limit={limit}
/>
This setup also supports type="line"
charts and includes overlays like SMA
, EMA
, and BollingerBands
.
-
CandlestickChart
: Interactive candlestick renderer with support for OHLC data. -
RSIPanel
: Relative Strength Index indicator with overbought/oversold zones. -
MACDPanel
: MACD with histogram, signal line, and grid overlay. -
SMA
,EMA
,BollingerBands
: Utility overlays usable withCandlestickChart
. -
ZoomableCandlestickChart
: Wrapper component that adds mouse wheel + pinch zoom/pan support to CandlestickChart, RSIPanel, and MACDPanel.
<CandlestickChart
data={ohlcData}
width={800}
height={400}
showVolume={true}
overlays={[<SMA period={20} />, <BollingerBands period={20} />]}
/>
-
data
: Array of OHLC objects{ timestamp, open, high, low, close, volume }
-
width
,height
: Size of the chart -
showVolume
: Toggle volume bars -
overlays
: Optional overlay components like SMA, EMA, BollingerBands
<RSIPanel
visibleData={data.slice(-50)}
fullData={data}
width={800}
height={150}
startIndex={0}
limit={50}
/>
-
visibleData
: Subset of OHLC data to display -
fullData
: Full dataset for calculating indicators -
width
,height
,startIndex
,limit
: Chart layout control -
styles
: Optional customization
<MACDPanel
visibleData={data.slice(-50)}
fullData={data}
width={800}
height={150}
startIndex={0}
limit={50}
/>
-
visibleData
: Subset of OHLC data to display -
fullData
: Full dataset for MACD computation -
styles
: Optional style overrides
<ZoomableCandlestickChart
data={ohlcData}
width={1200}
chartHeight={500}
rsiHeight={150}
macdHeight={200}
minLimit={30}
maxLimit={300}
initialLimit={100}
chartProps={{ ... }}
rsiProps={{ ... }}
macdProps={{ ... }}
showRSI={true}
showMACD={true}
/>
Adds synchronized zoom/pan support across Candlestick, RSI, and MACD.
-
showRSI
: (defaulttrue
) Toggle to display or hide the RSI panel. -
showMACD
: (defaulttrue
) Toggle to display or hide the MACD panel.
To build the library:
npm run build:lib
To develop with a demo app:
npm run dev:demo
npm test
npm run lint
npm run format
Copyright © Sai Teja Reddy Kommuri 2025 Use of this package is governed by a restrictive license. See the LICENSE file included in the package for full terms.