Skip to content
GetProfitable
Search

Pine Script for TradingView: Indicators, Alerts and Strategies

Write your own TradingView indicators, alerts and backtests in Pine Script v6. Script structure, types and series, built-ins and multi-timeframe data, inputs and on-chart visuals, repaint-safe alerts, strategy orders with stops and sizing, reading the Strategy Tester honestly, and two full projects.

Module 1: The Pine editor and your first indicator

Where the editor lives, how a script is laid out, indicator() versus strategy(), and plotting close with a moving average.

  1. Script structure and the version line10 min
  2. indicator() versus strategy()10 min
  3. Plotting close and an SMA11 min

Take the module quiz

Module 2: Language basics

Types and qualifiers, series versus simple, var, if and ternaries, functions, arrays, na handling and the errors everyone hits.

  1. Types, and series versus simple11 min
  2. Variables, var, if and ternaries11 min
  3. Functions, arrays and na handling12 min

Take the module quiz

Module 3: Built-ins

The ta.* and math.* namespaces, request.security for higher timeframes without lookahead, bar states, sessions and time.

  1. The ta.* and math.* namespaces11 min
  2. request.security and multi-timeframe data12 min
  3. Bar states, sessions and time11 min

Take the module quiz

Module 4: Inputs and visuals

Every input.* type with groups and tooltips, shapes and background colour, labels, lines and an on-chart stats table.

  1. Inputs, groups and tooltips11 min
  2. plotshape, plotchar and bgcolor10 min
  3. Labels, lines and tables12 min

Take the module quiz

Module 5: Alerts

alertcondition versus alert(), message placeholders and webhook JSON, once per bar close, and repainting explained and avoided.

  1. alertcondition versus alert()10 min
  2. Messages, placeholders and webhook JSON11 min
  3. Repainting, explained and avoided12 min

Take the module quiz

Module 6: Strategies

strategy(), entries and exits, stops and targets with strategy.exit, pyramiding, commission and slippage, sizing by risk, and what a backtest cannot know.

  1. strategy(), entries and exits11 min
  2. Stops, targets and strategy.exit12 min
  3. Sizing, commission, slippage and what a backtest cannot know12 min

Take the module quiz

Module 7: Reading the Strategy Tester

Net profit versus expectancy, drawdown, sample size and overfitting, forward testing, the bar magnifier and Deep Backtesting limits.

  1. Net profit versus expectancy11 min
  2. Drawdown, sample size and overfitting12 min
  3. Forward testing, the bar magnifier and Deep Backtesting11 min

Take the module quiz

Module 8: Projects

Build a VWAP plus opening-range breakout indicator with alerts, a pullback-to-EMA strategy with ATR stops, then publish, protect or package as a library.

  1. Project: a VWAP plus opening-range breakout indicator with alerts13 min
  2. Project: a pullback-to-EMA strategy with ATR stops13 min
  3. Publishing, libraries and next steps10 min

Take the module quiz

Educational content, not financial advice.