Skip to content
Wildflower
Join free
Automated trading and AI

Free Trading School · Level 7 · Course 7.11

Alerts and webhooks

Lesson 3 of 19 in Automated trading and AIModule 1: What automation is

Advanced · Automated trading and AI

Alerts and webhooks

Wildflower Trading School · Lesson 7.11.1.3

Wildflower

An alert usually tells you something. A webhook lets it tell another program instead. By the end of this lesson, you'll know what a webhook is and how a TradingView alert sends one. You'll also know what the message inside looks like, and the ways it can fail to arrive.

1 of 10

What you'll learn

  • Tell an alert from a webhook. An alert tells you. A webhook tells a program.
  • Set one up in TradingView. Tick Webhook URL in the alert and add the address.
  • Write the message. It's often JSON text. Placeholders get swapped for real values.
  • Check the alert log. A webhook can arrive late, twice or not at all.
  • Protect your logins. Never put a password or login in a webhook message.

Exercise

  1. Write down the four links a passes through: the platform, the internet, the receiving program and the .
  2. Next to each, write one way it could fail, and how you would find out.

Next: What a trading bot really is.

Quick check

  1. 1. What does a webhook do?

  2. 2. According to TradingView’s help, where can you see whether a webhook reached its address?

  3. 3. Which of these should never go in a webhook message?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “What a trading bot really is” is waiting next time.

Read the full notes

A webhook is a message a platform sends to another program's web address when an alert goes off; on TradingView you tick Webhook URL in the alert, write the message (often as JSON with placeholders), and check the log, because a webhook can arrive late or not at all.

  • A tells you (Alerts). A sends the same moment to a program's web address. That program decides what to do: write it down, message you, or place an order through a 's .
  • On TradingView (a simplified drawing; the layout changes, and other platforms exist): open the alert box, pick the condition (for a strategy, its order fills), write the Message, tick Webhook URL and add the address, then Create. TradingView's help says webhooks need , and not every plan includes them.
  • The message is often . Placeholders, written as a name inside double curly brackets (such as the ticker or the close), are swapped for real values when the alert goes off.
  • What can go wrong (from TradingView's help): a webhook may occasionally fail to arrive (check the webhook status column in the alert log); a request is cancelled if the receiving server takes longer than three seconds. A repeated message can mean a repeated order if the receiver doesn't check its . Never put passwords or logins in the message.
  • Made-up timing: alert 10:05:00.000, received 10:05:00.600, order at the broker 10:05:00.950: 950 ms before any fill. See Delay and speed and Latency in trading.
  • Answer to the drill: 1,250 ms. Guide: TradingView alerts and webhooks.

Worked example

Made-up numbers

Timing one webhook

Made-up times

  1. Alert goes off: 10:05:00.000.
  2. Program receives it: 10:05:00.600.
  3. Order reaches the broker: 10:05:00.950.

950 ms pass before the exchange has filled anything.

Your turn

Drill

Made-up times · alert 14:30:00.000 · message received 14:30:00.800 · order at the broker 14:30:01.250

Trading is risky. You can lose money, and automated trading can lose like any other trading. This lesson explains how things work. It isn’t advice.