Skip to main content

Strategy

A Pine strategy calculates values and places orders in TradingView's broker emulator. Its results depend on both the trading rules and the strategy settings. An indicator must be given explicit entry and exit rules before its signals can be evaluated as a strategy.

Create a strategy​

Open Visual Pine Editor, follow the application link, and select a strategy workflow in your workspace. Use the account's available features and the current manual if your interface differs from the screenshot.

Earlier visual-editor strategy creation dialog

General and trading properties​

  • Name and overlay: Set the script title and chart placement.
  • Initial capital and currency: Establish the simulation's starting account and reporting currency.
  • Order size: Choose units, a cash amount, or a percentage of equity. Verify what the exported strategy actually uses.
  • Pyramiding: Controls additional same-direction entries placed with strategy.entry().
  • Commission: Include the fee model applicable to the test.
  • Slippage: A tick-based adjustment used for relevant simulated order fills; it is not a percentage.
  • Margin: Sets the equity requirement for long and short positions.

Calculation and fill settings​

After order fills adds a calculation after a simulated fill. It does not decide whether an already-existing stop or limit may fill intrabar, and extra historical calculations can produce optimistic results.

On every tick adds calculations on realtime updates. Historical bars do not contain the same complete tick stream, so historical and realtime behavior can differ.

Bar Magnifier uses available lower-timeframe data to refine historical fills. It does not reproduce every live execution detail.

Process orders on close allows an additional attempt to process orders on the closing tick. It does not guarantee that a live order sent after a market closes can fill at that close.

See TradingView's strategy execution documentation for the underlying behavior.

Inspect the resulting trades​

Compile the generated script and record the symbol, timeframe, date range, inputs, and properties. Compare entry and exit prices with the trade list; inspect gaps and order creation times. Follow Create Your First Strategy for a worked configuration example.