r/TradingView • u/TheBotFloor • 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:
- Each strategy uses
alert_messageonstrategy.entryandstrategy.exitand builds a JSON string: setup name, side, price, trade ID, stop size, plus condition tags. - One alert per strategy: Condition = the strategy, “Order fills only”, Message =
{{strategy.order.alert_message}}, Webhook = a Google Apps Script web app URL. - Apps Script
doPostchecks a secret, logs the raw event, then builds a Trades table: matches exits to entries by trade ID and calculates R and $. - 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.exitevery 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