Webhook-based Trading Bot

This trading bot automatically places your trading orders by receiving signals (alerts) from TradingView via webhooks. It works with three brokers—Tradier, Alpaca and Tradovate—to execute trades based on the details you provide in your TradingView alerts.

How It Works

1. Receiving Alerts: When you set up an alert on TradingView, a message (in JSON format) is sent to the bot. This message includes all the essential details—such as which broker to use, whether to buy or sell, which stock (ticker) to trade, and how many shares.

2. Checking the Details: The bot ensures all required information is present and even checks if the market is open (based on EST) unless you’re in testing mode.

3. Placing Orders:

4. Logging and Notifications: To keep you informed, the bot sends updates and error messages to Discord using dedicated webhooks. You’ll receive a confirmation when a new trading signal is processed as well as any error notifications.

5. Extra Features: The bot can also close or liquidate positions automatically if needed. It even supports after-hours trading.

Setting Up Your TradingView Alerts

Use this webhook URL (https://webhooknextjs.vercel.app/api/webhook) for your TradingView alerts. Modify at least two JSON signals—one for buy and one for sell. Replace the account ID and token with your own Account ID and Access Token in the JSON examples below, then paste the appropriate JSON into your TradingView alert message box based on your indicator's buy or sell signal.

For Tradier Orders

Buy Signal for Tradier

{
  "Broker": "Tradier",
  "Action": "buy",
  "Ticker": "{{ticker}}",
  "Quantity": "10",
  "LimitPrice": "{{close}}",
  "Tradier_Account_ID": "VA712334962",
  "TradierAccessToken": "GQkjksJLASKuefDfhUiOISBSWKwT"
}

Sell Signal for Tradier

{
  "Broker": "Tradier",
  "Action": "sell",
  "Ticker": "{{ticker}}",
  "Quantity": "10",
  "LimitPrice": "{{close}}",
  "Tradier_Account_ID": "VA712334962",
  "TradierAccessToken": "GQkjksJLASKuefDfhUiOISBSWKwT"
}

For Alpaca Orders

Buy Signal for Alpaca

{
  "Broker": "Alpaca",
  "Action": "buy",
  "Ticker": "{{ticker}}",
  "Quantity": "100",
  "LimitPrice": "{{close}}",
  "API_KEY": "PKEMWB0ZCZACMDSGZYMD",
  "API_SECRET": "itAed9eJwDjVIb34JIieiNLTpySKnL3cnfacPIey"
}

Sell Signal for Alpaca

{
  "Broker": "Alpaca",
  "Action": "sell",
  "Ticker": "{{ticker}}",
  "Quantity": "100",
  "LimitPrice": "{{close}}",
  "API_KEY": "PKEMWB0ZCZACMDSGZYMD",
  "API_SECRET": "itAed9eJwDjVIb34JIieiNLTpySKnL3cnfacPIey"
}

For Future Trading on Tradovate

Buy Signal for Tradovate

{
  "Broker": "Tradovate",
  "Action": "buy",
  "Ticker": "{{ticker}}",
  "Quantity": "1",
  "TakeProfitPoints": "5",
  "StopLossPoints": "4",
  "LimitPrice": "{{close}}",
  "Username": "JohnDoe",
  "Password": "1234",
  "AppId": "Sample App",
  "DeviceId": "5678",
  "API_KEY": "CLIENT_ID",
  "API_SECRET": "CLIENT SECRET"
}

Sell Signal for Tradovate

{
  "Broker": "Tradovate",
  "Action": "sell",
  "Ticker": "{{ticker}}",
  "Quantity": "1",
  "TakeProfitPoints": "5",
  "StopLossPoints": "4",
  "LimitPrice": "{{close}}",
  "Username": "JohnDoe",
  "Password": "1234",
  "AppId": "Sample App",
  "DeviceId": "5678",
  "API_KEY": "CLIENT_ID",
  "API_SECRET": "CLIENT SECRET"
}

Additional Information

Important Notice on Tradovate Futures Trading:
Please note that Tradovate futures trading is currently available only through demo (paper) accounts. The JSON signals sent to the bot include sensitive credentials. If you require a private webhook server for enhanced security during live trading, we offer a lifetime license for $5000. This license covers the setup of a dedicated webhook server on Vercel—or as a Docker container on platforms such as AWS, Heroku, DigitalOcean, or Azure—with full source code provided. By default, a webhook server on Vercel stores your sensitive credentials on Vercel’s infrastructure; however, if you need even greater security, we can implement advanced encryption and customized secure storage solutions tailored to your needs.

Dedicated Webhook Server – Monthly License:
For users who prefer not to commit to a lifetime license, we offer a dedicated webhook server service at $50 per month. This plan supports up to 4000 JSON signals per month, making it ideal for reliable and secure automated trading with predictable monthly costs.

Windows Version of the Bots:
We also offer a Windows version of our trading bots, which allows you to store your credentials locally on your own computer for an added layer of security.

Disclosure and Disclaimer:
Please be aware that all trading involves risk. The signals provided are for informational purposes only, and no guarantee is made regarding trade performance. Users are responsible for their own trading decisions and should conduct thorough research. Our service is provided on an "as-is" basis, and we disclaim any liability for any losses incurred.

In Summary

This system removes the stress of manual trading. By setting up TradingView alerts that send simple JSON messages to the bot, your trades are automatically executed at the right time, and you’re kept informed via Discord notifications. Customize the JSON examples to match your trading style, and enjoy seamless, automated trading.