Skip to content

indicator() - Pine Script Function

Every indicator script must start with indicator(). This declaration names the script, decides whether plots appear on the price chart, and sets limits (labels, lines, boxes). Many arguments are optional; you only need to supply the ones you rely on.

indicator(title, shorttitle, overlay, format, precision, scale, max_bars_back, timeframe, timeframe_gaps, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count, calc_bars_count, max_polylines_count, dynamic_requests, behind_chart) → void
NameTypeDescription
titleconst stringFull name shown in the chart and indicators list. Required.
shorttitleconst stringOptional shorter name displayed on chart overlays.
overlayconst booltrue plots on the price chart, false plots in a separate pane (default false).
precision / formatconst int/const stringControl numerical formatting of plots.
max_lines_count, max_labels_count, max_boxes_countconst intIncrease drawing limits when you need more objects.
timeframe, timeframe_gapsconst string/const boolRun the indicator on a different resolution and control gap handling.
dynamic_requestsconst boolAllow request.* calls with dynamic symbols/timeframes (Pine v5).

See the TradingView docs for the full list.

  • indicator() must appear before any plotting or logic.
  • Indicators cannot trade—use strategy() when you need order functions.
  • Set drawing limits only as high as required; overly large values slow scripts.
//@version=5
indicator("Adaptive EMA", shorttitle="AEMA", overlay=true, max_lines_count=5)
lenFast = input.int(12, "Fast length")
lenSlow = input.int(26, "Slow length")
emaFast = ta.ema(close, lenFast)
emaSlow = ta.ema(close, lenSlow)
plot(emaFast, "Fast", color=color.teal)
plot(emaSlow, "Slow", color=color.orange)
plot(close, "Close", color=color.new(color.gray, 70))