Article

Pine Script Indicator vs Strategy: What Each One Can Do

indicator() draws and alerts, strategy() simulates orders and reports trade stats. Here is how to choose, how to keep the same signals in both, and where each one stops.

Lee, who builds MyLinedChart

Author: Lee H., from Little Bird Trading

Created OCTOBER 5, 2026 | Last updated OCTOBER 5, 2026

  • Topic: pine script indicator vs strategy difference tradingview indicator() vs strategy()
  • Audience: Pine Script users, TradingView traders, traders turning signals into trading rules
Technical AnalysisPine Script usersTradingView traderstraders turning signals into trading rulespine script indicator vs strategy d…

Every Pine Script file starts with one declaration, indicator() or strategy(), and that single word decides what the script can do. An indicator plots, labels and fires alerts. A strategy does all of that and also runs simulated orders through TradingView's broker emulator, so it can report net profit, drawdown and a list of trades. Traders often write the same signal twice and then wonder why the two disagree. This guide lays out the difference and a clean way to keep one source of truth.

The one-line difference

indicator() declares a study. An indicator can compute values, plot them, draw shapes, labels, lines and tables, and trigger alerts with alertcondition() or alert(). An indicator cannot hold a position.

strategy() declares a backtest. A strategy can do everything an indicator draws and also call strategy.entry, strategy.exit, strategy.order and strategy.close. TradingView's broker emulator fills those simulated orders and the Strategy Tester shows performance, trades and drawdown.

Which one to use

  • Use an indicator for context: bias, levels, regime, dashboards and signal markers you read by eye.
  • Use an indicator when the script must run alongside many others; strategies are heavier and one strategy per chart is the norm.
  • Use a strategy when you need trade statistics: win rate, profit factor, drawdown, average trade.
  • Use a strategy to test exits, because stops and targets only exist inside strategy.exit.

Why the same signal looks different in each

Three settings cause most mismatches between a plotshape marker and a strategy fill.

  • Timing: strategies calculate on bar close unless calc_on_every_tick is on, and a market order fills on the next bar's open. An indicator marker sits on the signal bar itself.
  • Position state: a strategy ignores a new long signal while already long, unless pyramiding allows it. The indicator draws every signal.
  • Costs: commission and slippage settings change the strategy's numbers and never touch the indicator.

Keep one set of trading rules

Write the conditions once at the top of the file as named booleans, such as longSignal and exitSignal. In the indicator, feed them to plotshape and alertcondition. In the strategy, feed the same booleans to strategy.entry and strategy.exit. When you change a rule, copy the condition block across unchanged, so only the output layer differs.

Many traders keep a third copy of the rule in writing, with the levels it refers to. MyLinedChart helps with that side: you draw the levels, the app exports them with the candles and indicator values as CSV, XLSX or JSON, and an AI app connected to the chart can turn a drawn level into a written trading rule. MyLinedChart can also import a .pine indicator into a formula indicator; strategy.* calls are reported rather than converted, because a formula computes one value per bar and does not hold positions. See Import a TradingView Pine Script.

Limits worth knowing

  • Indicator alerts and strategy alerts are set up differently; strategy alerts fire on order fills.
  • A strategy backtest is a simulation on historical bars. Intrabar order of high and low is assumed unless you use bar magnifier on plans that offer it.
  • max_lines_count, max_labels_count and max_boxes_count apply to both types.
  • Educational only. A good backtest is not a forecast.

FAQ

Can one Pine Script be both an indicator and a strategy?

No. The file declares one or the other. Keep the signal conditions identical in two files instead.

Why does my strategy enter one bar after my indicator's arrow?

Strategies fill market orders on the next bar's open by default, while the indicator marks the signal bar.

Do indicators show win rate?

No. Trade statistics come from the Strategy Tester, which only runs strategies.

Can MyLinedChart run my Pine strategy?

MyLinedChart imports Pine indicators into formula indicators. Strategy order calls are listed as unsupported rather than approximated.

Sample Structured Chart-Data Exports

Review how chart drawings, annotations, OHLC, volume, and execution context become reusable structured data.

Related Articles

More Video Guides