What is Indicator Mode#

Indicator mode is QuantScript’s charting and analysis workflow. Scripts in indicator mode compute and visualise technical indicators, overlays, and oscillator panes without any trade execution — the ideal environment for exploring market structure, validating signals visually, and building custom chart studies.

Like every QuantScript mode, indicator scripts use the same language, the same ta.* library, and the same candle event model. An indicator you build today can later become the signal logic of a backtested strategy — just change the mode() declaration and add trading logic.

QuantScript
mode(mode_type: "indicator");
indicator(title: "My Custom Study");
candles(symbol: "BTCUSD", resolution_type: "1h", bars: 500);

Indicator mode supports historical batch rendering and optional streaming, runs deterministically, and requires no broker connection.

Built-in Indicator Library#

QuantScript ships 50+ built-in technical indicators in the ta.* namespace — all computed incrementally, candle by candle, with no external dependencies:

CategoryFunctions
Trendta.sma(), ta.ema(), ta.wma(), ta.supertrend(), ta.adx(), ta.vwma(), ta.hull()
Momentumta.rsi(), ta.macd(), ta.stoch(), ta.roc(), ta.mfi(), ta.cci()
Volatilityta.bbands(), ta.atr(), ta.kc(), ta.stdev()
Volumeta.obv(), ta.vwap(), ta.mfi()
Cross detectionta.crossover(), ta.crossunder()

Indicators compose naturally: ta.rsi(ta.ema(close, 20), 14) computes the RSI of an EMA, and ta.crossover(fast, slow) detects signal crosses — the same building blocks used in production strategies.

See the full list in the API Reference — ta.*.

The chart.* API#

The chart.* namespace renders computed series onto the price chart or into separate oscillator panes:

  • chart.plot(series, title, color) — plot a line, area, histogram, or other style on the main chart or a pane.
  • chart.plotshape(series, title, style, color) — plot shape markers (arrows, circles, flags) on signal bars.
  • chart.hline(price, title, color) — draw a horizontal reference line (e.g., RSI 70/30 levels).
  • chart.bgcolor(color) — conditional per-bar background coloring (e.g., tint bars by trend direction).
  • chart.fill(plot1, plot2, color) — fill the area between two plotted series (e.g., Bollinger Bands).
  • chart.pane("oscillator") — switch subsequent plots into a separate lower pane.
  • chart.label.new(x, y, text, color, style) — place text annotations at specific bars.
QuantScript
// Overlay: EMA ribbon on the price chart
chart.plot(ta.ema(close, 20), "EMA 20", "#2196F3");
chart.plot(ta.ema(close, 50), "EMA 50", "#FF9800");

// Separate oscillator pane: MACD histogram
let macd = ta.macd(close, 12, 26, 9);
chart.pane("oscillator");
chart.plot(macd.histogram, "MACD Hist", "#9C27B0", { style: "histogram" });
chart.hline(0, "Zero", "#888");

See the full API in the API Reference — chart.*.

Complete Example#

A minimal indicator script: SMA trend overlay plus RSI oscillator pane, with user-adjustable inputs:

QuantScript
mode(mode_type: "indicator");
indicator(title: "SMA Trend + RSI");
candles(symbol: "BTCUSD", resolution_type: "1m", bars: 100);

const fastLen = input.int(10, "Fast SMA", 3, 50);
const slowLen = input.int(30, "Slow SMA", 10, 200);

event.onCandle((candle) => {
  chart.plot(ta.sma(candle.close, fastLen), "Fast SMA", "#2196F3");
  chart.plot(ta.sma(candle.close, slowLen), "Slow SMA", "#FF9800");

  chart.pane("oscillator");
  chart.plot(ta.rsi(candle.close, 14), "RSI", "#9C27B0");
  chart.hline(70, "Overbought", "#f85149");
  chart.hline(30, "Oversold", "#3fb950");
});

Run it in the browser playground at quantscript.com/playground — or explore the full annotated source in the Indicator Example.

Next Steps#