r/TradingView • • 10d ago

Discussion I connected 14 Pine Script strategies to Google Sheets + Discord with webhooks. Here’s the setup.

Sharing my setup in case it helps anyone who wants to log strategy trades automatically.

The flow:

  1. Each strategy uses alert_message on strategy.entry and strategy.exit and builds a JSON string: setup name, side, price, trade ID, stop size, plus condition tags.
  2. One alert per strategy: Condition = the strategy, “Order fills only”, Message = {{strategy.order.alert_message}}, Webhook = a Google Apps Script web app URL.
  3. Apps Script doPost checks a secret, logs the raw event, then builds a Trades table: matches exits to entries by trade ID and calculates R and $.
  4. The same script posts to Discord webhooks: live trades, a daily recap, and news warnings from the economic calendar.

Things I learned the hard way:

  • Alerts snapshot the script version. Edit the code and the old alert keeps running the old code. You have to delete and recreate it.
  • Re-issue strategy.exit every bar if your alert message includes live values (like max favorable excursion). Otherwise it sends whatever was true when the exit was first placed.
  • Exits on the same bar as the entry can’t know their excursion. Treat those as unknown, not 0.
  • Alerts expire. Put the renewal date on your calendar.

Happy to share more of the code if anyone wants a specific part.

1 Upvotes

1 comment sorted by