Skip to content

What settings do TradingView indicators and strategies share?

What settings do TradingView indicators and strategies share?

Section titled “What settings do TradingView indicators and strategies share?”

TL;DR
indicator() and strategy() both accept title, shorttitle, overlay, precision, and max_labels_count (among others). Strategies add trading-specific fields like pyramiding and commission.

SettingIndicatorStrategyPurpose
title, shorttitleNames shown on charts and in dialogs.
overlayDraw on price chart or separate pane.
precision / formatControl numerical formatting.
max_labels_count, max_lines_countGuard against excessive drawings.
pyramidingAllow multiple entries per direction.
calc_on_every_tick, calc_on_order_fillsAdvanced strategy evaluation modes.
commission_*, initial_capital, default_qty_*Backtest configuration and order sizing.
timeframe, timeframe_gapsIndicators can request alternative timeframes directly.
  • Open any script and locate the declaration line (indicator(... or strategy(...).
  • List the shared options you rely on—consider converting when you need strategy-only features.
  • Use code snippets below to switch between indicator and strategy versions.
//@version=5
indicator(title="My Indicator", shorttitle="MI", overlay=false, precision=2, max_labels_count=50)
//@version=5
strategy(title="My Strategy", shorttitle="MS", overlay=true, precision=2, max_labels_count=50)

These options behave identically in both declarations, making it easy to port an indicator into a strategy shell (or vice versa) when you need to.

  • timeframe – evaluate indicator logic on another resolution.
  • timeframe_gaps – control how gaps are filled when using a custom timeframe.

If you require these settings in a trading system, consider building a hybrid: indicator for visualisation + alerts feeding a strategy elsewhere.

CategoryKey options
Order sizingdefault_qty_type, default_qty_value, currency, initial_capital
Order behaviourpyramiding, calc_on_order_fills, calc_on_every_tick, process_orders_on_close, backtest_fill_limits_assumption
Costs & riskcommission_type, commission_value, slippage, close_entries_rule

When you convert an indicator to a strategy, make sure to populate these or TradingView defaults will apply (e.g., 1 contract share, zero commission).

indicator("Baseline MA", overlay=true)
ma = ta.sma(close, 34)
plot(ma)

→ becomes

strategy("Baseline MA", overlay=true, pyramiding=1, initial_capital=10_000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
ma = ta.sma(close, 34)
plot(ma)

Add order commands and risk controls once the declaration is converted.

  • Shared settings (title, overlay, precision, drawing limits) behave the same for both script types.
  • Indicator-only settings revolve around multi-timeframe calculations; strategy-only settings configure trading, sizing, and costs.
  • Converting between script types is mostly about swapping the declaration and supplying the extra strategy fields.

Adapted from tradingcode.net, optimised for Algo Trade Analytics users.