Little Bird Trading

Pine Script Indicator Vs Strategy Guide

4 min read · Updated

On TradingView, an indicator and a strategy look similar in the Pine Editor, but they do fundamentally different jobs. One draws on your chart. The other pretends to trade. Confusing the two is the single most common reason a script that looks brilliant on history feels nothing like it did live. This guide keeps the distinction concrete and honest — no invented API details, just the parts that actually change your results.

The one-line difference

The very first line of a Pine script declares which kind it is. A script that opens with indicator() can only calculate and plot — lines, colors, labels, fills. It has no concept of a position, a fill price, or profit. A script that opens with strategy() adds an order-simulation engine: it can call functions like strategy.entry and strategy.exit, and TradingView runs those orders against historical bars to produce the Strategy Tester report — net profit, max drawdown, win rate, profit factor, and the list of simulated trades.

So the split is: an indicator describes conditions; a strategy asserts what those conditions would have earned. The second claim is far heavier than the first, because the moment you simulate orders you inherit a stack of assumptions about when and at what price those orders filled.

Where the backtest engine quietly makes assumptions

A strategy's equity curve is only as trustworthy as the fill assumptions underneath it. Four defaults do most of the damage:

  • Bar-close evaluation. By default the tester evaluates your logic when a bar closes. If a condition references the bar's own high, low, or close, the historical "fill" may use information a live trade could not have had until after the bar completed.
  • Next-bar-open fills. A market order placed on a signal fills at the open of the next bar in the simulation. On a fast open, that printed price can sit several ticks — or points — away from where you'd actually get filled.
  • Zero friction. If commission and slippage are left at zero in the strategy() call, every simulated trade is free. Real trading is not.
  • Sample size. The tester will happily report a gorgeous curve built on twelve trades. Twelve wins is noise wearing the costume of an edge.

A worked example

Say a strategy shows +$4,200 over 40 trades on ES futures with costs left at zero. Add a round-turn commission of about $5 — retail futures commissions vary widely by broker, so use your own — plus one tick of slippage per side. On ES a tick is 0.25 points, worth $12.50, so one tick each way is $25. That's roughly $30 of friction per trade, about $1,200 across 40 trades, dragging a headline +$4,200 down toward ~$3,000. And that's the polite version: if entries cluster on volatile opens, real slippage runs wider than one tick and the gap grows. None of that friction appears in the indicator version of the same logic, because an indicator never claims a fill in the first place. For more on separating a real edge from a fitted one, see how to spot overfit trading systems.

Repainting is a question, not an accusation

"Repainting" gets thrown at any script that shows different values in hindsight than it did in real time — but the label is often misapplied. The honest test is one question: could this decision have been made with the same information, at the same moment, live? A signal that only confirms on bar close hasn't deceived you; it just asks you to wait for the close. The genuinely misleading cases are signals plotted on the still-forming bar that then jump once it finishes, or higher-timeframe data pulled with lookahead. Evaluating logic on a confirmed bar keeps your backtest and your live experience honest with each other, whether you're building an indicator or a strategy.

How this maps onto the Trade Plans

Trade Plans deliberately sidesteps the repaint problem by handing you fixed, pre-planned levels instead of a reactive intrabar signal. The daily levels — the lean lines for ES, SPY, NQ, QQQ and 100+ tickers — are computed after the prior close and do not move during the session. There is nothing to repaint: the price where bias tips between headwinds and tailwinds is set before 9:30 ET and stays put. The MyLinedChart Pine indicators that draw those lines are exactly that — indicators. They plot the levels and simulate nothing, so they carry none of the fill or commission assumptions above. If a lean line disagrees with what your own strategy is telling you, that disagreement is information; often it's the market saying "perch" — wait.

A short checklist before you trust either script type

  • Know which you're holding: indicator() only draws; strategy() simulates orders and produces the Strategy Tester report.
  • On a strategy, set realistic commission and slippage for the instrument you actually trade before reading a single profit number.
  • Confirm logic on closed bars so history and live share the same decision moment.
  • Judge results on enough trades to matter, not the handful that happened to win.
  • Keep contextual overlays (like lean lines) separate from execution authority — the chart informs the call; your written rules make it.

Used this way, an indicator is a lens and a strategy is a hypothesis. Neither is a promise. The traders who stay out of trouble are the ones who never mistake a clean-looking chart for a validated fill.

Related Reading

Sources

Educational content only. Not investment advice.

Educational content only. Not investment advice.