WCT / TetherUS
Education

How To: Automate TradingView Alerts to Real Trades The Easy Way

257
Here’s a demonstration of how you can connect the dots using tools you probably already have: TradingView, email, and a simple automation setup on your computer.

How This Works
TradingView strategy spots a trade:
Your custom Pine Script runs on any chart, analyzing price action, trends, or pivots. When your strategy sees a buy or sell signal, it triggers an alert.

Alert lands in your email inbox:
TradingView sends a custom email alert (with your chosen keywords in the subject line) to your email account.

Your email app does the magic:
With a rule set up in Mozilla Thunderbird (or similar desktop email client), your computer can recognize the alert email as soon as it arrives.

Automatic trading bot executes the order:
The email filter launches a small program—your own buy or sell executable. This bot can be coded to interact with an exchange API (like Binance) and place the order, with whatever safety checks you want.

Step-by-Step Setup
1. Create Your Strategy in TradingView
Write your logic in Pine Script, or use any community script you like.

Set up an alert that sends you an email when a buy or sell is triggered.

Tip: Use specific words in the subject line like “order buy @” or “order sell @” to make automation easy.

2. Set Up Your Email Rule (Thunderbird Example)
Use Mozilla Thunderbird as your desktop mail client.

Go to Message Filters and create a new rule:

Condition: If Subject contains “order sell @” (for sell), or “order buy @” (for buy).

Action: Launch your chosen executable file (e.g., SELL SPOT AT MARKET PRICE.exe for sells, and a corresponding one for buys).

3. Create/Package Your Trading Bot
You can write your bot in Python and package it as a standalone .exe file with PyInstaller.

Example logic:

Connect to Binance using secure API keys (use keyring for safety).

On sell: place a limit sell order, and if it’s not filled in 30 seconds, cancel and execute a market sell instead.

On buy: same idea, but for buying.

4. Automate the Entire Chain
Once set up, the process is seamless:

TradingView strategy → Email alert → Thunderbird filter → Buy/Sell executable → Real trade

What’s Cool About This Demo
No manual clicking required.

You’re in control: Design your own entry/exit logic, risk management, and trade size.

Customizable: Works with any exchange that supports API trading.

Extensible: Add more rules, logging, or notifications as you wish.

Disclaimers
This workflow is for educational and demonstration purposes only.
You are fully responsible for your own trading actions, risk management, and system security.
I am not providing financial advice or trade recommendations.
Always test thoroughly—preferably with a demo account—before using real funds.
Keep your exchange API keys safe and never share your automation scripts.
How to Set Up Thunderbird to Process Emails and Trigger Scripts


This guide will help you configure Thunderbird to watch for TradingView alert emails and automatically launch your custom buy or sell executable file based on the alert type.

1. Install Thunderbird
Download Mozilla Thunderbird:
thunderbird.net/

Install and open Thunderbird on your computer.

2. Add Your Email Account
Add the email address where you receive TradingView alerts (e.g., Outlook, Gmail, etc.).

Let Thunderbird sync your inbox.

3. Prepare Your Executable Files
Have your buy and sell trading bots packaged as .exe files (e.g.,
BUY SPOT AT MARKET PRICE.exe and SELL SPOT AT MARKET PRICE.exe).

Place these files in a known folder, such as
C:\Users\YourName\Documents\buy sell executables\.

4. Set Up Message Filters in Thunderbird
a. Go to the menu and choose
 Tools → Message Filters...
 or
 Right-click your account in the left sidebar → Settings → Message Filters.

b. Click “New...” to create a new filter.

For a Sell Alert:
Filter Name: Subject contains: order sell @

Apply filter when:

✅ Getting New Mail

Match all of the following:

Subject contains order sell @

Perform these actions:

Launch File

Select your sell executable, e.g.:
C:\Users\YourName\Documents\buy sell executables\SELL SPOT AT MARKET PRICE.exe

For a Buy Alert:
Create a similar filter, but use:

Subject contains order buy @

Launch File → your buy executable, e.g.:
C:\Users\YourName\Documents\buy sell executables\BUY SPOT AT MARKET PRICE.exe

Tip: The “Launch File” action might require the “FiltaQuilla” add-on in Thunderbird, which enables advanced filtering actions like launching files.

5. Test Your Setup
Send yourself a test email with the appropriate subject line (e.g., order sell @).

If set up correctly, Thunderbird will process the new email and automatically run your chosen executable.

6. Going Live
Once tested, enable your TradingView alerts to email your account with the exact subject lines your filters are set to catch.

Your trading automation is now ready to work seamlessly!

Additional Notes
Security: Only set up automation on a trusted computer. Make sure your executables are secure and not accessible to others.

Logging: Consider adding logging in your Python bot to keep track of executed trades.

Add-ons:
If “Launch File” is not available, install the FiltaQuilla add-on in Thunderbird. After installation, the action “Launch File” will be available in the filter actions.

Summary Checklist
Thunderbird installed and set up with your email

Buy/sell scripts packaged as .exe files

Message filters set up for both buy and sell alerts

(Optional) FiltaQuilla add-on installed

Tested and working before going live


Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.