Skip to content

ATR Example

Render Average True Range in a separate volatility panel.

Code

tsx
import 'react-candlesticks/style.css';
import {
  ATR,
  Candlesticks,
  Chart,
  Panel,
  exampleData,
} from 'react-candlesticks';

export default function App() {
  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <Chart data={exampleData} granularity="d1" theme="dark">
        <Panel heightRatio={3}>
          <Candlesticks />
        </Panel>
        <Panel>
          <ATR period={14} />
        </Panel>
      </Chart>
    </div>
  );
}

React Candlesticks is available on npm and GitHub under the MIT License.