Video summary

How to Backtest a Trading Strategy on Tradingview

Main summary

Key takeaways

Finance

Finance-focused summary (backtesting on TradingView)

The video explains how to quickly backtest a trading strategy on TradingView using historical data (instantly, without waiting months/years) and how to evaluate results using TradingView’s built-in strategy tester outputs.

Instruments / tickers / assets mentioned

  • Vanguard S&P 500 (used as the example security; ticker not explicitly provided)
  • S&P 500 (referenced again for the date-range backtest)

Trading strategy framework (step-by-step)

A simple moving average crossover strategy is implemented in TradingView Pine Script.

Indicators / variables

  • ema20: 20-day EMA
  • ema50: 50-day EMA
  • EMA is calculated using close (explicitly noted: “best to read from the close”).

Signal logic

  • Long condition: ema20 is above ema50
  • Short condition: ema20 is below ema50

Order logic

  • Enter long using strategy.entry(...):
    • name: "entry long"
    • side: strategy.long
    • size: 1000 shares
    • execution trigger: when = long
  • Enter short similarly using strategy.entry(...):
    • side: strategy.short
    • size: 1000 shares
    • execution trigger: when = short

Closing positions (to prevent constantly opening new trades)

  • Use strategy.close:
    • close long when short is true
    • close short when long is true

Backtest execution

  • Use “Add to chart” to run the backtest.

Backtest period control (explicit timeline example)

The creator shows how to restrict testing to a specific date range using Pine Script timestamps.

Example shown

  • Start: 2019 August 1
  • End: 2020 (set to an August endpoint per description)

Execution logic

An if block runs the strategy only when:

  • time >= start and time <= end

Performance / evaluation metrics mentioned (TradingView tester)

TradingView’s strategy tester tabs are highlighted, including:

  • Equity curve
  • Net profit
  • Number of trades
  • Max drawdown
  • Average trade
  • Trade list (every trade with execution timing/details)

It also notes results can extend back to the 1970s unless restricted.

Plotting / visualization enhancements (for indicator verification)

To verify indicator behavior visually:

  • Use plot() to display moving averages
  • Set overlay=true to show indicators directly on the price chart

Key recommendations / cautions

  • Don’t rely on claims like “100% win rate”; test your own strategy on historical data and compare performance.
  • Even though the code is described as “basic,” the video emphasizes validating entry/exit placement using chart markers and tester outputs.

Disclosures / disclaimers

  • A not financial advice disclaimer is not explicitly stated in the provided subtitles.
  • TradingView is mentioned as free and not requiring a paid subscription.

Presenters / sources

  • Presenter: Unspecified individual (YouTube creator; no name given in subtitles)
  • Source platform: TradingView (Pine Script; built-in functions like ema, strategy.entry, strategy.close, plot, and timestamp utilities)

Original video