Pine Script
Pine Script is TradingView's programming language for custom indicators and strategies. Strategy orders are simulated unless a separate alert or integration is used. It is not a signal.
On this page
Pine Script is TradingView's programming language for custom indicators and strategies on a TradingView chart. It is not a signal, and not a forecast. An indicator can calculate and display values, and can be used to create alerts. A strategy can do that too, and can also send simulated orders to TradingView's broker emulator and show a strategy report. Unlike a program that can place orders on a platform such as MetaTrader, those simulated fills are not orders at a broker. TradingView has its own page. MetaTrader 4 and 5 has its own page.
How Pine Script Runs
A script is written in the Pine Editor and added to a chart. Indicators produce visuals, alerts, or logs; they are not used for a strategy backtest. Strategies use the broker emulator to simulate trades on historical and realtime bars, and to display hypothetical results. Pine Script cannot place orders directly with a broker, with TradingView's Trading Panel, or with TradingView's built-in paper account. A user can create an alert from a script, including when a strategy's simulated order is filled in realtime. That alert can be sent to an external address with a webhook, and a separate service may then send an order to a broker. A webhook is not itself a fill, and it can fail to arrive. There is no universal performance figure for Pine scripts.
A Simple Example
Suppose the account equity is 10,000.00 and 1% is 100.00. An illustrative strategy is set to simulate a long of 50.00 units at 100.00, with a stop at 98.00 — not a live script and not a recommended rule. If the emulator fills that stop at 98.00, the simulated loss is (100.00 − 98.00) × 50.00, or 100.00. That 100.00 figure is a report on the chart, not a broker fill. A live order would be sent only if a separate alert, webhook, or other integration is used, and a live fill can differ from 98.00. Those prices are not a reason to buy or sell, and they are not a record of any live strategy. Fees and slippage in a live account can change the result.
Practical Point
A common mistake is to treat a strategy report as if it were a live trading record, or a past test as a forecast. Another is to assume that adding a strategy to a chart places broker orders, or that an alert is the same as a fill. Use Pine Script as a tool for analysis and simulation, and treat it as a program, not as a signal.