Debugging the Connection Between PineScript and TBOT: A Step-by-Step Guide
Background
In this guide, I'll explain the process of debugging the connection between PineScript and TBOT on TradingBoat, focusing on a high-level overview.
From a high-level perspective, there are two main things to verify:
- Ensure that your customized PineScript transmits alert messages.
- Confirm that you receive messages from TBOT.
Verifying Your Customized PineScript
After creating your custom PineScript, you should observe an ongoing Alerts log, particularly in the bottom right corner of the displayed image. If these logs are not visible, you'll need to modify your PineScript code to display them. Since the function makeWebhookJson()
merely produces a string message, if your script doesn't generate any alert messages, the issue likely lies within your custom PineScript indicator or strategy.
Verify Your Alert Message
When your script begins sending Alerts Logs within the TradingView window, you should subsequently notice these alert messages within the WebUI of TBOT on TradingBoat.
If these Alert Messages are absent, ensure you've correctly set up your Webhook URL, webhookKey, and message format.
Please note: Observing alert messages on the WebUI doesn't necessarily mean they result in order placements. Let's delve into an example.
Imagine TBOT receives the alert message strategy.entrylong
. This message includes the following values:
These alerts encompass a market order (entry-order), ProfitTaker, and StopLoss.
Now, let's say 10 minutes later, TBOT receives a strategy.exitlong
alert. If TBOT determines any of the following conditions are true, this alert will be disregarded:
- The market order remains pending (due to reasons like out-of-market hours, network issues, etc.).
- ProfitTaker has already been filled.
- StopLoss is executed.
It's essential to understand that even if an order gets executed on TradingView, it doesn't guarantee that TBOT has processed the same order.
Please consult this guideline from TradingView for further clarity: TradingView Strategy Alerts
For instance, if TBOT gets a strategy.exitlong
alert after a strategy.entrylong
alert has been executed and completed, the subsequent strategy.exitlong
alert will be ignored.
Further details and procedures, I highly recommend referring to the comprehensive Udemy course available here: Link to Udemy Course.