Is the data delayed?

Yes and no. Quoted from TradingView:

We provide real-time data for free whenever we’re allowed. However, some data is delayed due to specific exchange regulations. Because of this, real-time data must be purchased separately using the page below. US stock market data is real-time and provided by CBOE BZX.


TradingView_TA does not support paid real-time data at the moment.


Please refer to TradingView’s website to see whether the data is delayed or not.

How do I get past data?

Retrieving past data is currently not supported.

How do I create a trading bot?


Trading (especially using bots) is very risky. I won’t be responsible for any financial loss. You have been warned.

The pseudocode below should help you get started in creating your own trading bot.

# Import packages.
from tradingview_ta import TA_Handler, Interval, Exchange
import time

# Store the last order.
last_order = "sell"

# Instantiate TA_Handler.
handler = TA_Handler(

# Repeat forever.
while True:
    # Retrieve recommendation.
    rec = handler.get_analysis()["RECOMMENDATION"]

    # Create a buy order if the recommendation is "BUY" or "STRONG_BUY" and the last order is "sell".
    # Create a sell order if the recommendation is "SELL" or "STRONG_SELL" and the last order is "buy".
    if "BUY" in rec and last_order == "sell":
        # REPLACE COMMENT: Create a buy order using your exchange's API.

        last_order = "buy"
    elif "SELL" in rec and last_order == "buy":
        # REPLACE COMMENT: Create a sell order using your exchange's API.

        last_order = "sell"

    # Wait for x seconds before retrieving new analysis.
    # The time should be the same as the interval.


last_order won’t be saved when the program exit. When the bot restarts, it will always create a new buy order.


Always paper trade before risking your money.

How can I get involved?

If you found a bug, please create an issue on the GitHub repository.

You can contribute (new features, bug fix, typo, etc) through the GitHub repository. Please follow the guidelines and don’t send spammy pull requests.

How does TradingView_TA works?

A simple network inspection on TradingView’s website revealed that the data is retrieved through an undocumented API.

TradingView_TA works by calculating similar data using algorithms reverse-engineered from their JavaScript code.

Why do I get 4XX error?

400 error indicates that the request is invalid. Usually, this is caused when the indicators does not exist. See https://pastebin.com/1DjWv2Hd for valid indicators.

404 error indicates that the webpage does not exist. Usually, this is caused when the screener does not exist. Check if the screener, symbol, and exchange are correct using this tool: https://tvdb.brianthe.dev.