Indicators
Trend
Ichimoku Cloud, Supertrend, Parabolic SAR, ADX / DMI, Aroon and Elder Ray.
"use client";
import { ChartCanvas, Pane } from "@reincharts/core";
import { CandlestickSeries } from "@reincharts/series";
import { Indicator, indicators } from "@reincharts/indicators";
import { Grid, XAxis, YAxis } from "@reincharts/axes";
import { Crosshair } from "@reincharts/coordinates";
import { Legend } from "@reincharts/tooltip";
import { useState } from "react";
import { Segmented, WithToolbar } from "@/components/preview/controls";
import { daily } from "@/lib/data";
import { useDocsChartTheme } from "@/lib/use-docs-theme";
const ids = ["ichimoku", "supertrend", "sar"] as const;
export default function TrendIndicators() {
const theme = useDocsChartTheme();
const [id, setId] = useState<(typeof ids)[number]>("ichimoku");
return (
<WithToolbar toolbar={<Segmented label="indicator" value={id} options={ids} onChange={setId} />}>
<ChartCanvas data={daily} theme={theme} barSpacing={8}>
<Pane>
<Grid />
<CandlestickSeries name="MSFT" />
{/* key: remount when the definition changes (new legend item / styles) */}
<Indicator key={id} definition={indicators[id]} />
<YAxis />
<Legend title="MSFT · 1D" />
</Pane>
<XAxis />
<Crosshair />
</ChartCanvas>
</WithToolbar>
);
}Overlays
<Indicator definition={indicators.ichimoku} />
<Indicator definition={indicators.supertrend} inputs={{ factor: 3 }} />
<SAR />Ichimoku draws the conversion and base lines, the lagging span and the cloud between the leading spans (shifted forward, green when bullish and red when bearish). Supertrend switches between an up-trend and a down-trend line, and Parabolic SAR is drawn as dots.
Trend strength
ADX / DMI, Aroon and Elder Ray go in their own pane.