← Back to list

Strategies vs Indicators in Pine Script

If you’ve just opened the Pine Editor, you’ve probably noticed two kinds of scripts — Indicators and Strategies. They look almost…

Bhaskar Das in Algorithmic and Quantitative Trading · 2026-06-28 09:37 · 0 claps · 2.1 min read paywalled
#pine-script #tradingview #algotrading #nasdaq #nyse
Open on Medium ↗
Wiki topics: INV · Investing & Markets

Strategies vs Indicators in Pine Script

If you’ve just opened the Pine Editor, you’ve probably noticed two kinds of scripts — Indicators and Strategies. They look almost identical, but they serve completely different purposes.

In this article, you’ll learn:

  • What an Indicator is
  • What a Strategy is
  • When to use each one
  • How to write both.

Let’s get started.

The first decision you’ll make is:

Do I want to visualize data or test a trading system?

The answer determines whether you create an Indicator or a Strategy.

Think of It Like This

Imagine you’re driving a car.

Indicator = Dashboard

The dashboard tells you:

  • Current speed
  • Fuel level
  • Engine temperature

It gives information.

It never drives the car.

Strategy = Driving Simulator

A simulator doesn’t just display speed.

It actually:

  • Accelerates
  • Brakes
  • Changes gears
  • Calculates fuel usage
  • Shows total distance

Likewise, a Strategy actually simulates trades.

What is an Indicator?

An Indicator performs calculations and displays results on the chart.

Examples include:

  • Moving Average
  • RSI
  • MACD
  • Bollinger Bands
  • VWAP

Indicators answer questions like:

  • Is price trending?
  • Is RSI overbought?
  • Where is support?
  • Has volatility increased?

Indicators never place trades.

They simply provide information.

Your First Indicator

Every Pine indicator begins with:

//@version=6
indicator("Simple Moving Average", overlay=true)
length = input.int(20)
ma = ta.sma(close, length)
plot(ma, color=color.blue, linewidth=2)

What happens here?

  • Creates an indicator
  • Calculates a 20-period SMA
  • Draws it on the chart

What is a Strategy?

A Strategy is designed to simulate trading decisions.

Instead of only showing information, it can:

  • Enter trades
  • Exit trades
  • Calculate profit
  • Calculate losses
  • Show win rate
  • Backtest years of historical data

Strategies answer a different question:

Would this trading idea have actually made money?

Your First Strategy

Replace indicator() with strategy().

//@version=6
strategy("Simple SMA Strategy", overlay=true)
fast = ta.sma(close,20)
slow = ta.sma(close,50)
plot(fast)
plot(slow)
if ta.crossover(fast, slow)
    strategy.entry("Buy", strategy.long)
if ta.crossunder(fast, slow)
    strategy.close("Buy")

Now something completely different happens.

TradingView starts simulating trades.

Open the Strategy Tester, and you’ll see:

  • Net Profit
  • Win Rate
  • Number of Trades
  • Drawdown
  • Equity Curve

This is impossible with an Indicator.

The Biggest Difference

An Indicator can only observe the market.

A Strategy can act on the market (in a simulated environment).

Think of it this way:

Indicator:

The price crossed above the moving average.

Strategy:

Buy because the price crossed above the moving average.

One informs.

One makes decisions.

Which One Should You Learn First?

Start with Indicators.

Why?

Because they teach you:

  • Variables
  • Calculations
  • Functions
  • Plotting
  • Conditions

Once you’re comfortable, move on to Strategies.

Strategies build on the same concepts while introducing:

  • Orders
  • Position management
  • Risk control
  • Performance metrics

Learning Indicators first makes the transition to Strategies much easier.

Final Thoughts

Many beginners believe they need a Strategy to display a moving average or an RSI.

They don’t.

Likewise, many try to backtest an Indicator and wonder why nothing happens.

Remember this simple rule:

Indicators analyze. Strategies evaluate.

Master Indicators first, then learn Strategies to test whether your ideas actually work in the market.


메타데이터
post_id
a8a2eb7bc4f5
slug
strategies-vs-indicators-in-pine-script-a8a2eb7bc4f5
url
https://medium.com/algorithmic-and-quantitative-trading/strategies-vs-indicators-in-pine-script-a8a2eb7bc4f5
canonical_url
https://medium.com/algorithmic-and-quantitative-trading/strategies-vs-indicators-in-pine-script-a8a2eb7bc4f5
author_url
https://medium.com/@bhaskarndas
status
ok
fetched_at
2026-07-09 15:12:33