Skip to content

Custom Indicators

The library ships 11 TradingView-style indicator templates, all registered automatically via registerExtensions. Each uses the TA library for calculations and custom draw functions for TradingView-like styling (gradient fills, dashed level lines, multi-color histograms).

import { indicators } from "react-klinecharts-ui";
// indicators === [bollTv, cci, hma, ichimoku, maRibbon, macdTv,
// pivotPoints, rsiTv, stochastic, superTrend, vwap]

Add and remove them with useIndicators. Note the demo below uses the built-in klinecharts indicators (MA, BOLL, MACD, …); the custom templates use the names in the tables below (BOLL_TV, MACD_TV, …).

TemplateNameDefault paramsDescription
bollTvBOLL_TV[20, 2]Bollinger Bands, TradingView style — filled band area, SMA midline, upper/lower bands
hmaHMA[9]Hull Moving Average — high smoothing, minimal lag
ichimokuICHIMOKU[9, 26, 52, 26]Ichimoku Cloud — Tenkan, Kijun, Senkou A/B (filled cloud), Chikou
maRibbonMA_RIBBON[5, 10, 20, 30, 50, 100]6 EMAs with distinct colors
pivotPointsPIVOT_POINTS[1]Pivot + R1/R2/S1/S2 as dashed lines
superTrendSUPERTREND[10, 3]ATR-based trend with green/red coloring
vwapVWAP[]Volume Weighted Average Price — single line
TemplateNameDefault paramsDescription
macdTvMACD_TV[12, 26, 9]4-color histogram + MACD/Signal lines
rsiTvRSI_TV[14, 14]RSI + MA, dashed 70/50/30 levels, gradient OB/OS zones
cciCCI[20]Commodity Channel Index, dashed +100/0/-100
stochasticSTOCHASTIC[14, 1, 3]%K / %D lines, dashed 80/50/20 levels

The templates are registered with the chart automatically. To add one to the chart, use the imperative useIndicators actions or the chart API directly:

const { addMainIndicator, addSubIndicator } = useIndicators();
addMainIndicator("SUPERTREND");
addSubIndicator("MACD_TV");