Get your API key

Lesson 5 of 5

Alerts and reading the Strategy Tester honestly

Add alerts, turn the indicator into a test strategy with costs and slippage, and read the report without fooling yourself.

10 min Log in to open

Education only. This is not investment advice and nothing here is a buy or sell recommendation. Trading carries risk of loss, and past results do not predict the future. Practise with TradingView's Paper Trading (fake money) only, never connect broker API keys or place live orders from these lessons. For personal advice, talk to a SEBI-registered Investment Adviser.

One step at a time, like flipping pages.

By the end of this lesson you will add alerts to your indicator, turn the crossover rule into a test strategy with costs and slippage, and read the Strategy Tester report without fooling yourself.

You need: the crossover script from lesson 2, TradingView, an AI chat or agent · Time: 10 minutes

  1. An alert tells you when your rule fires, so you don't have to stare at the chart. Pine has two ways to create alert events:

    • alertcondition() adds a named alert option to an indicator. You then pick it in TradingView's Create Alert dialog, in the Condition field.
    • alert() fires from inside the script's logic and works in indicators and strategies.

    For our indicator, add two lines at the end:

    Pine Script
    // Alert options that appear in the Create Alert dialog
    alertcondition(crossUp, "Fast above slow", "Fast EMA crossed above slow EMA on {{ticker}} ({{interval}})")
    alertcondition(crossDown, "Fast below slow", "Fast EMA crossed below slow EMA on {{ticker}} ({{interval}})")

    {{ticker}} and {{interval}} are placeholders TradingView fills in with the symbol and timeframe. When you create the alert, choose the Once Per Bar Close frequency, so it matches your "closed bars only" rule.

    Why?

    An alert is a reminder to go and study the chart. In this course nothing is ever connected to a broker: no broker API keys, no automatic orders. A rule you have not tested for months should not be able to spend money.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. Turn the rule into a test strategy
  2. Where the report lives
  3. Read the report honestly
  4. Paper trade, then keep learning
  5. Recap